How to use describe_stack_set_operation method in localstack

Best Python code snippet using localstack_python

cfstackset_notification.py

Source:cfstackset_notification.py Github

copy

Full Screen

...34 35 if eventName == 'CreateStackInstances':36 stackSetName = event['detail']['requestParameters']['stackSetName']37 operationId = event['detail']['responseElements']['operationId']38 response = cf.describe_stack_set_operation(StackSetName=stackSetName, OperationId=operationId)39 status = response['StackSetOperation']['Status']40 while status == 'RUNNING':41 time.sleep(10)42 response = cf.describe_stack_set_operation(StackSetName=stackSetName, OperationId=operationId)43 status = response['StackSetOperation']['Status']44 45 if status == 'SUCCEEDED':46 dev_endpoint = "https://" + stackSetName + ".dkr.dev.dot-nonprod.corppvt.cloud"47 qa_endpoint = "https://" + stackSetName + ".dkr.qa.dot-nonprod.corppvt.cloud"48 stage_endpoint = "https://" + stackSetName + ".dkr.stage.dot-nonprod.corppvt.cloud"49 prodblue_endpoint = "https://" + stackSetName + ".dkr.prod-blue.dot-nonprod.corppvt.cloud"50 prod_endpoint = "https://" + stackSetName + ".dkr.prod.dot-nonprod.corppvt.cloud"51 message = "StackSet Creation for Application " + stackSetName + " completed successfully \n Application Name: " + stackSetNamae + "\n ECR Name: " + stackSetName.lower() + "\n DEV Endpoint: " + dev_endpoint + "\n QA Endpoint: " + qa_endpoint + "\n STAGE Endpoint: " + stage_endpoint + "\n PROD_BLUE Endpoint: " + prodblue_endpoint + "\n PROD Endpoint: " + prod_endpoint52 print message53 sendnotification(stackSetName, nonprod_acc, message)54 elif status == 'FAILED':55 message = "StackSet Creation for Application " + stackSetName + " Failed"56 print message...

Full Screen

Full Screen

DefaultRegionOnboardingLambdaHandler.py

Source:DefaultRegionOnboardingLambdaHandler.py Github

copy

Full Screen

...27 Regions=[region28 ])29 logger.info("Stack instance response for new account {} ".format(str(response)))30 operation_id = response['OperationId']31 status_response = cloudformation_client.describe_stack_set_operation(32 StackSetName=region_onboarding_stackset,33 OperationId=operation_id34 )35 count = 036 while status_response['StackSetOperation']['Status']=='RUNNING':37 # Terminate the wait condition after 4 mins38 count += 139 if count > 8:40 break41 time.sleep(30)42 status_response = cloudformation_client.describe_stack_set_operation(43 StackSetName=region_onboarding_stackset,44 OperationId=operation_id45 )46 result['accountOnboardingStatus'] = status_response['StackSetOperation']['Status']47 if status_response['StackSetOperation']['Status']=='SUCCEEDED':48 result['defaultRegionOnboardingStatus'] = 'COMPLETED'49 except Exception as e:50 logger.info("Region onboarding has some issues. Please check")51 result['defaultRegionOnboardingStatus'] = 'FAILED'52 return result53def get_mandatory_evar(evar_name):54 if not evar_name in os.environ:55 raise RuntimeError("Missing environment variable: {}".format(evar_name))56 return os.environ[evar_name]

Full Screen

Full Screen

retry.py

Source:retry.py Github

copy

Full Screen

...22client = boto3.client('cloudformation')23def wait_operation_is_complete(stackset_name, operation_id):24 """Simple waiter for cloudformation stackset operation"""25 client = boto3.client("cloudformation")26 response = client.describe_stack_set_operation(27 StackSetName=stackset_name, OperationId=operation_id28 )29 while not response["StackSetOperation"]["Status"] in ["FAILED", "SUCCEEDED"]:30 time.sleep(5)31 response = client.describe_stack_set_operation(32 StackSetName=stackset_name, OperationId=operation_id33 )34 logger.info(35 f"The {response['StackSetOperation']['Action']} Operation id {operation_id} \36 has status {response['StackSetOperation']['Status']}"37 )38def import_stack(stackset_name, instances):39 """Impport stack instances into a stackset."""40 logger.info(f"Starting to migrate {len(instances)} instances into {stackset_name}")41 client = boto3.client("cloudformation")42 for i in range(0, len(instances), 10):43 logger.info(f"Import stack instances from {i} to {i+10}")44 response = client.import_stacks_to_stack_set(45 StackSetName=stackset_name,...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful