def handle_is_complete()

in custom-resource-runtime/ec2-deployer/index.py [0:0]


def handle_is_complete(event):
  deployment_id = event['PhysicalResourceId']

  print(f'Deployment ID: {deployment_id}')

  response = client.get_deployment(
    deploymentId=deployment_id
  )

  print(f'Response: {response}')

  status = response['deploymentInfo']['status']
  print(f'Deployment Status: {status}')

  if (status == 'Failed' or status == 'Stopped'):
    error_code = response['deploymentInfo'].get('errorInformation').get('code')
    error_message = response['deploymentInfo'].get('errorInformation').get('message')
    raise RuntimeError(f'Deployment {status} - {error_code}: {error_message}')

  is_ready = status == 'Succeeded'

  returnValue = { 'IsComplete': is_ready }
  print(f'Return: {returnValue}')
  return returnValue