def execute_cfn_change_set(change_set_id):
cfn = boto3.client('cloudformation', region_name=AWS_DEFAULT_REGION)
print('Executing CloudFormation change set...')
cfn.execute_change_set(ChangeSetName=change_set_id)
while True:
response = get_cfn_stack_info()
if response is None:
status = 'UNKNOWN'
else:
status = response.get('StackStatus', 'UNKNOWN')
print('Status: ' + status)
if 'StatusReason' in response:
print('Reason: ' + response['StatusReason'])
if status.endswith('FAILED') or status == 'ROLLBACK_COMPLETE':
exit(1)
elif status == 'UNKNOWN':
print('Stack info:\n' + json.dumps(response, sort_keys=True, indent=4, default=str))
elif status.endswith('COMPLETE'):
return
time.sleep(SLEEP_TIME)
评论列表
文章目录