This is an automated email from the ASF dual-hosted git repository. lfrolov pushed a commit to branch DATALAB-2125 in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit 72f67cdd6b90833fc3c3ac1cdcd141bcfde98bdf Author: leonidfrolov <[email protected]> AuthorDate: Tue May 18 17:16:39 2021 +0300 [DATALAB-2125]: added retry for gcp vpc removal --- .../src/general/lib/gcp/actions_lib.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py index d9b0648..77a9adb 100644 --- a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py +++ b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py @@ -97,9 +97,16 @@ class GCPActions: def remove_vpc(self, vpc_name): request = self.service.networks().delete(project=self.project, network=vpc_name) + allow = False + count = 0 try: - result = request.execute() - datalab.meta_lib.GCPMeta().wait_for_operation(result['name']) + while not allow and count < 5: + result = request.execute() + datalab.meta_lib.GCPMeta().wait_for_operation(result['name']) + if datalab.meta_lib.GCPMeta().get_vpc(vpc_name) == '': + allow = True + else: + count = count + 1 print("VPC {} has been removed".format(vpc_name)) return result except Exception as err: --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
