This is an automated email from the ASF dual-hosted git repository. lfrolov pushed a commit to branch epm-v2.5.2.1 in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit dcfd333cdb17aecb7cf8d30bb1c1002076189653 Author: leonidfrolov <[email protected]> AuthorDate: Fri Oct 28 16:52:02 2022 +0300 added region check for subnet --- .../src/general/scripts/gcp/common_create_subnet.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/infrastructure-provisioning/src/general/scripts/gcp/common_create_subnet.py b/infrastructure-provisioning/src/general/scripts/gcp/common_create_subnet.py index 1153aad62..ca0f70da7 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/common_create_subnet.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/common_create_subnet.py @@ -50,7 +50,8 @@ if __name__ == "__main__": empty_vpc = True subnets = [] for subnet in subnets: - subnets_cidr.append(GCPMeta().get_subnet(subnet.split('/')[-1], args.region)['ipCidrRange']) + if args.region in subnet: + subnets_cidr.append(GCPMeta().get_subnet(subnet.split('/')[-1], args.region)['ipCidrRange']) sortkey = lambda addr: \ (int(addr.split("/")[0].split(".")[0]), int(addr.split("/")[0].split(".")[1]), @@ -103,7 +104,8 @@ if __name__ == "__main__": existed_subnet_list = [] response = GCPMeta().get_vpc(args.vpc_selflink.split('/')[-1])['subnetworks'] for subnet in response: - existed_subnet_list.append(GCPMeta().get_subnet(subnet.split('/')[-1], args.region)['ipCidrRange']) + if args.region in subnet: + existed_subnet_list.append(GCPMeta().get_subnet(subnet.split('/')[-1], args.region)['ipCidrRange']) available_subnets = list(set(pre_defined_subnet_list) - set(existed_subnet_list)) if not available_subnets: logging.info("There is no available subnet to create. Aborting...") --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
