def get_stack_events(cfn, stack_name):
 ret = {'events': [], 'log': []}
 try:
  events = cfn.describe_stack_events(StackName=stack_name)
 except (botocore.exceptions.ValidationError, botocore.exceptions.ClientError) as err:
  error_msg = boto_exception(err)
  if ('does not exist' in error_msg):
   ret['log'].append('Stack does not exist.')
   return ret
  ret['log'].append(('Unknown error: ' + str(error_msg)))
  return ret
 for e in events.get('StackEvents', []):
  eventline = 'StackEvent {ResourceType} {LogicalResourceId} {ResourceStatus}'.format(**e)
  ret['events'].append(eventline)
  if e['ResourceStatus'].endswith('FAILED'):
   failline = '{ResourceType} {LogicalResourceId} {ResourceStatus}: {ResourceStatusReason}'.format(**e)
   ret['log'].append(failline)
 return ret

def get_stack_events ( cfn , stack_name ) : ret = { 'events' : [ ] , 'log' : [ ] } try : events = cfn . describe_stack_events ( StackName = stack_name ) except ( botocore . exceptions . ValidationError , botocore . exceptions . ClientError ) as err : error_msg = boto_exception ( err ) if ( 'does not exist' in error_msg ) : ret [ 'log' ] . append ( 'Stack does not exist.' ) return ret ret [ 'log' ] . append ( ( 'Unknown error: ' + str ( error_msg ) ) ) return ret for e in events . get ( 'StackEvents' , [ ] ) : eventline = 'StackEvent {ResourceType} {LogicalResourceId} {ResourceStatus}' . format ( ** e ) ret [ 'events' ] . append ( eventline ) if e [ 'ResourceStatus' ] . endswith ( 'FAILED' ) : failline = '{ResourceType} {LogicalResourceId} {ResourceStatus}: {ResourceStatusReason}' . format ( ** e ) ret [ 'log' ] . append ( failline ) return ret
this event data was never correct .