def remove_instance(self, name): self.task_manager.create(name) metadata = self.storage.find_instance_metadata(name) config = copy.deepcopy(self.config) if metadata and "plan_name" in metadata: plan = self.storage.find_plan(metadata["plan_name"]) if plan: config.update(plan.config) if metadata and metadata.get("consul_token"): self.consul_manager.destroy_token(metadata["consul_token"]) self.consul_manager.destroy_instance(name) self.storage.decrement_quota(name) self.storage.remove_task(name) self.storage.remove_binding(name) self.storage.remove_instance_metadata(name) tasks.RemoveInstanceTask().delay(config, name)
def remove_instance(self, name): if not self.consul_manager.check_swap_state(name, None): raise consul_manager.InstanceAlreadySwappedError() self.task_manager.create(name) metadata = self.storage.find_instance_metadata(name) config = copy.deepcopy(self.config) if metadata and "plan_name" in metadata: plan = self.storage.find_plan(metadata["plan_name"]) if plan: config.update(plan.config) if metadata and "flavor_name" in metadata: flavor = self.storage.find_flavor(metadata["flavor_name"]) if flavor: config.update(flavor.config) if metadata and metadata.get("consul_token"): self.consul_manager.destroy_token(metadata["consul_token"]) self.storage.decrement_quota(name) self.storage.remove_task(name) self.storage.remove_binding(name) self.storage.remove_instance_metadata(name) tasks.RemoveInstanceTask().delay(config, name)
def remove_instance(self, name): self.storage.decrement_quota(name) self.storage.remove_task(name) self.storage.remove_binding(name) self.storage.remove_instance_metadata(name) tasks.RemoveInstanceTask().delay(self.config, name)