You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2021/04/22 14:48:34 UTC
[incubator-datalab] 02/02: [DATALAB-2091]: fixed key and
ip_addresses format
This is an automated email from the ASF dual-hosted git repository.
lfrolov pushed a commit to branch DATALAB-2091
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit 19c4149af3e0ba768d25024c10ab9c6bc995ca0b
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Thu Apr 22 17:46:34 2021 +0300
[DATALAB-2091]: fixed key and ip_addresses format
---
.../src/general/scripts/azure/common_create_subnet.py | 4 ++--
.../src/general/scripts/azure/project_prepare.py | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/infrastructure-provisioning/src/general/scripts/azure/common_create_subnet.py b/infrastructure-provisioning/src/general/scripts/azure/common_create_subnet.py
index 0698645..6345565 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/common_create_subnet.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/common_create_subnet.py
@@ -41,7 +41,7 @@ if __name__ == "__main__":
try:
empty_vpc = False
private_subnet_size = ipaddress.ip_network(u'0.0.0.0/{}'.format(args.prefix)).num_addresses
- first_vpc_ip = int(ipaddress.IPv4Address(args.vpc_cidr.split('/')[0].decode("utf-8")))
+ first_vpc_ip = int(ipaddress.IPv4Address(args.vpc_cidr.split('/')[0]))
subnets_cidr = []
subnets = AzureMeta().list_subnets(args.resource_group_name, args.vpc_name)
for subnet in subnets:
@@ -52,7 +52,7 @@ if __name__ == "__main__":
last_ip = first_vpc_ip
for cidr in sorted_subnets_cidr:
- first_ip = int(ipaddress.IPv4Address(cidr.split('/')[0].decode("utf-8")))
+ first_ip = int(ipaddress.IPv4Address(cidr.split('/')[0]))
if first_ip - last_ip < private_subnet_size:
subnet_size = ipaddress.ip_network(u'{}'.format(cidr)).num_addresses
last_ip = first_ip + subnet_size - 1
diff --git a/infrastructure-provisioning/src/general/scripts/azure/project_prepare.py b/infrastructure-provisioning/src/general/scripts/azure/project_prepare.py
index 0fee636..29fce72 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/project_prepare.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/project_prepare.py
@@ -99,7 +99,7 @@ if __name__ == "__main__":
project_conf['endpoint_name'])
ssh_key_path = os.environ['conf_key_dir'] + os.environ['conf_key_name'] + '.pem'
key = RSA.importKey(open(ssh_key_path, 'rb').read())
- project_conf['public_ssh_key'] = key.publickey().exportKey("OpenSSH")
+ project_conf['public_ssh_key'] = key.publickey().exportKey("OpenSSH").decode('UTF-8')
project_conf['instance_storage_account_type'] = 'Premium_LRS'
project_conf['image_name'] = os.environ['azure_{}_image_name'.format(os.environ['conf_os_family'])]
project_conf['instance_tags'] = {"Name": project_conf['instance_name'],
@@ -144,6 +144,7 @@ if __name__ == "__main__":
logging.info(json.dumps(project_conf))
except Exception as err:
datalab.fab.append_result("Failed to generate variables dictionary.", str(err))
+ traceback.print_exc()
sys.exit(1)
try:
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org