def list_namespaces(self): namespace_list = [] try: namespaces = self.api_instance.list_namespace() for n in namespaces.items: namespace = NameSpace(name=n.metadata.name, status=n.status.phase) namespace_list.append(namespace.__dict__) except ApiException as e: logger.error(msg='list namespace error ' + e.reason, exc_info=True) return namespace_list