def _enqueue_delete_namespace(self, namespace_name, ns_uuid): ns_delete_event = self.create_delete_namespace_event( namespace_name, ns_uuid) NamespaceKM.delete(ns_uuid) for project in ProjectKM.objects(): k8s_namespace_name = project.get_k8s_namespace_name() if k8s_namespace_name == namespace_name: ProjectKM.delete(project.uuid) self.enqueue_event(ns_delete_event)
def _enqueue_delete_namespace(self, namespace_name, ns_uuid): ns_delete_event = self.create_delete_namespace_event( namespace_name, ns_uuid) NamespaceKM.delete(ns_uuid) for project in ProjectKM.objects(): k8s_namespace_name = project.get_k8s_namespace_name() if k8s_namespace_name == namespace_name: ProjectKM.delete(project.uuid) self.enqueue_event(ns_delete_event) self.wait_for_all_tasks_done()
def _delete_project(self, project_name): project_fq_name = ['default-domain', project_name] project = self._vnc_lib.project_read(fq_name=project_fq_name) for sg in project.get_security_groups() or (): self._delete_security_group(sg['uuid']) for si in project.get_service_instances() or (): self._vnc_lib.service_instance_delete(id=si['uuid']) for vn in project.get_virtual_networks() or (): self._delete_virtual_network(vn['uuid']) self._vnc_lib.project_delete(fq_name=project_fq_name) ProjectKM.delete(project.uuid)