def _delete_network(self, project, cluster_name):
try:
resp = self.compute_service.networks().delete(
project=project,
network=cluster_name
).execute()
except Exception as e:
fmlogger.error(e)
network_deleted = False
count = 0
while not network_deleted and count < GCLOUD_ACTION_TIMEOUT:
try:
network_obj = self.compute_service.networks().get(
project=project,
network=cluster_name
).execute()
except Exception as e:
fmlogger.error(e)
network_deleted = True
else:
time.sleep(1)
count = count + 1
if count >= GCLOUD_ACTION_TIMEOUT:
message = ("Failed to delete network {network_name}").format(network_name=cluster_name)
raise exceptions.EnvironmentDeleteFailure("Failed to delete network ")
评论列表
文章目录