def poll()

in functions/source/CfnCrossRegion/lambda_function.py [0:0]


def poll(event, context):
    stack_id = event["PhysicalResourceId"]
    cfn_client = get_client("cloudformation", event, context)
    stack = cfn_client.describe_stacks(StackName=stack_id)['Stacks'][0]
    response_data = {}
    if stack['StackStatus'] in cfn_states['failed']:
        error = "Stack launch failed, status is %s" % stack['StackStatus']
        if 'StackStatusReason' in stack.keys():
            error = "Stack Failed: %s" % stack['StackStatusReason']
        raise Exception(error)
    elif stack['StackStatus'] in cfn_states['success']:
        if 'Outputs' in stack.keys():
            for o in stack['Outputs']:
                response_data[o['OutputKey']] = o['OutputValue']
        response_data['Complete'] = True
    return stack_id, response_data