def wait(stack, show_events=False, last_event=None):
"""wait for stack action to complete"""
global REGION
stack_obj = boto3.resource('cloudformation', region_name=REGION).Stack(stack)
while True:
try:
stack_obj.reload()
# display new events
if show_events:
last_event = stack_events(stack, last_event=last_event)
# exit condition
if stack_obj.stack_status[-8:] == 'COMPLETE':
break
if stack_obj.stack_status == 'DELETE_FAILED':
break
except botocore.exceptions.ClientError:
break
# limit requests to API
sleep(5)
# command functions
评论列表
文章目录