Best Python code snippet using localstack_python
handler.py
Source:handler.py
...38 detectionIDs[i['StackName']] = detectionID['StackDriftDetectionId']39 time.sleep(5)40 41 for stackName, detectionID in detectionIDs.items():42 driftStatus = cfstack.describe_stack_drift_detection_status( StackDriftDetectionId=detectionID)43 44 while driftStatus['DetectionStatus'] == 'DETECTION_IN_PROGRESS':45 time.sleep(5)46 driftStatus = cfstack.describe_stack_drift_detection_status( StackDriftDetectionId=detectionID )47 48 if driftStatus['StackDriftStatus'] == 'DRIFTED':49 stack_arn = driftStatus['StackId']50 payload = {51 "attachments":[52 {53 "fallback":'<https://' + region + '.console.aws.amazon.com/cloudformation/home?region=' + region + '#/stack/detail?stackId=' + stack_arn + '| View>',54 "pretext":'<https://' + region + '.console.aws.amazon.com/cloudformation/home?region=' + region + '#/stack/detail?stackId=' + stack_arn + '| View>',55 "color":"#D00000",56 "fields":[57 {58 "title":"Drift Detected Region: " + region,59 "value": stackName,60 "short": "false"...
handle_drift.py
Source:handle_drift.py
...28 status == 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS':29 time.sleep(5)30 status = self.client.describe_stacks(StackName=stack_name)['Stacks'][0]['StackStatus']31 drift_id = self.client.detect_stack_drift(StackName=stack_name)['StackDriftDetectionId']32 detection_status_response = self.client.describe_stack_drift_detection_status(StackDriftDetectionId=drift_id)33 while detection_status_response['DetectionStatus'] == 'DETECTION_IN_PROGRESS':34 time.sleep(5)35 detection_status_response = self.client.describe_stack_drift_detection_status(StackDriftDetectionId=drift_id)36 return detection_status_response['StackDriftStatus']37if __name__ == "__main__":38 """39 Takes arguments when run from the command line40 """41 parser = argparse.ArgumentParser()42 parser.add_argument("StackName", help="")43 parser.add_argument("Region", help="")44 parser.add_argument("ProfileName", help="")45 args = parser.parse_args()46 session = boto3.Session(profile_name=args.ProfileName)47 cf = session.client('cloudformation', region_name=args.Region)48 # get a list of our stacks once deployment is complete49 dh = DriftHandler(args.StackName, cf)...
detect_drift.py
Source:detect_drift.py
...6id6 = detection_id['StackDriftDetectionId']7#print (id6)8print ("------------")9time.sleep (3)10response = client.describe_stack_drift_detection_status(StackDriftDetectionId=detection_id['StackDriftDetectionId'])11#response = client.describe_stack_drift_detection_status(StackDriftDetectionId="0ec97ed0-acd1-11ea-9a6f-02abe6210ac8")12while response['DetectionStatus'] == "DETECTION_IN_PROGRESS":13 print ("Detection in progres")14 time.sleep(5)15 print ( "retrying" )16print (response['StackId'])17print (response['StackDriftStatus'])18print (response['DetectionStatus'])...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!