in source/state_machine_handler.py [0:0]
def notify(self):
try:
self.logger.info("Executing: " + self.__class__.__name__ + "/" + inspect.stack()[0][3])
if environ.get('APPROVAL_NOTIFICATION').lower() == 'yes' and self.event.get('Status') == 'requested':
self._send_email()
self.logger.info("Adding tag to VPC with the pending approval message")
if self.event.get('AssociationNeedsApproval') == 'yes':
self._create_tag(self.event.get('VpcId'), 'VPCAssociation',
'Request to associate this VPC with requested TGW Routing Table is PENDING APPROVAL. '
'Contact your network admin for more information.')
if self.event.get('PropagationNeedsApproval') == 'yes':
self._create_tag(self.event.get('VpcId'), 'VPCPropagation',
'Request to propagate this VPC to requested TGW Routing Table is PENDING APPROVAL. '
'Contact your network admin for more information.')
elif self.event.get('Status') == 'rejected':
self.logger.info("Adding tag to VPC with the rejection message")
if self.event.get('AssociationNeedsApproval') == 'yes':
self._create_tag(self.event.get('VpcId'), 'VPCAssociation',
'Request to associate this VPC with requested TGW Routing Table has been REJECTED. '
'Contact your network admin for more information.')
if self.event.get('PropagationNeedsApproval') == 'yes':
self._create_tag(self.event.get('VpcId'), 'VPCPropagation',
'Request to propagate this VPC to requested TGW Routing Table has been REJECTED. '
'Contact your network admin for more information. ')
else:
self.logger.info("Approval notifications are disabled. Please set CFN template variable "
"'ApprovalNotification' to 'Yes' if you wish to receive notifications.")
return self.event
except Exception as e:
message = {'FILE': __file__.split('/')[-1], 'CLASS': self.__class__.__name__,
'METHOD': inspect.stack()[0][3], 'EXCEPTION': str(e)}
self.logger.exception(message)
self._update_ddb_failed(e)
raise