def is_deleted(self): """Checks if the resource is deleted. Fetch resource by id from service and check it status. In case of NotFound or status is DELETED or DELETE_COMPLETE returns True, otherwise False. """ try: resource = self._manager().get(self.id()) except Exception as e: return getattr(e, "code", getattr(e, "http_status", 400)) == 404 return utils.get_status(resource) in ("DELETED", "DELETE_COMPLETE")
def _list_statuses(mgr): for resource in mgr.list(**list_query): status = bench_utils.get_status(resource) if status not in statuses: return False return True