def failed_validation(self, exists): reconciled = False region = self._region_for_usage(exists) if not region: return False try: instance = self.client.get_instance(region, exists.instance, get_metadata=True) match_code = self._fields_match(exists, instance) if match_code == 0: self._reconcile_instance(exists, self.client.src_str, deleted_at=exists.deleted_at) reconciled = True else: msg = "Exists %s failed reconciliation with code %s" msg %= (exists.id, match_code) stacklog.info(msg) except exceptions.NotFound: stacklog.info("Couldn't find instance for exists %s" % exists.id) return reconciled
def missing_exists_for_instance(self, launched_id, period_beginning): reconciled = False launch = models.InstanceUsage.objects.get(id=launched_id) region = self._region_for_usage(launch) if not region: return False try: instance = self.client.get_instance(region, launch.instance) if instance['deleted'] and instance['deleted_at'] is not None: # Check to see if instance has been deleted deleted_at = instance['deleted_at'] if deleted_at < period_beginning: # Check to see if instance was deleted before period. # If so, we shouldn't expect an exists. self._reconcile_instance(launch, self.client.src_str, deleted_at=instance['deleted_at']) reconciled = True except exceptions.NotFound: stacklog.info("Couldn't find instance for launch %s" % launched_id) return reconciled
def failed_validation(self, exists): reconciled = False region = self._region_for_usage(exists) try: instance = self.client.get_instance(region, exists.instance, get_metadata=True) match_code = self._fields_match(exists, instance) if match_code == 0: self._reconcile_instance(exists, self.client.src_str, deleted_at=exists.deleted_at) reconciled = True else: msg = "Exists %s failed reconciliation with code %s" msg %= (exists.id, match_code) stacklog.info(msg) except exceptions.NotFound: stacklog.info("Couldn't find instance for exists %s" % exists.id) return reconciled