def execute_task(self): log.debug(u"CreateMapping for notification %s" % self._notification) # Determine the public ip address of our instance. ip_address = self._get_instance_ip(self._notification.instance_id) log.error("IP: %s", ip_address) if not ip_address: return [] # Determine the processor_id that is handling our naming processor_id = self.get_processor_id() # If we couldn't find processor_id, keep message and we'll retry message later. log.error('Processor Id: %s', processor_id) if not processor_id: return [] # Create the new route. processor = DNSProcessor(None, self._table, self._notification.region) try: delete_notification = processor.add_instance_mapping(processor_id, self._notification.instance_id, ip_address) except ValueError: log.exception("Invalid mapping to add") delete_notification = True # Delete our notification if delete_notification: self._notification.delete()
def execute_task(self): log.debug(u"CreateMapping for notification %s" % self._notification) # Determine the public ip address of our instance. ip_address = self._get_instance_ip(self._notification.instance_id) log.error("IP: %s", ip_address) if not ip_address: return [] # Determine the processor_id that is handling our naming processor_id = self.get_processor_id() # If we couldn't find processor_id, keep message and we'll retry message later. log.error('Processor Id: %s', processor_id) if not processor_id: return [] # Create the new route. processor = DNSProcessor(None, self._table, self._notification.region) try: delete_notification = processor.add_instance_mapping( processor_id, self._notification.instance_id, ip_address) except ValueError: log.exception("Invalid mapping to add") delete_notification = True # Delete our notification if delete_notification: self._notification.delete()