diff --git a/pyazhpc/azconfig.py b/pyazhpc/azconfig.py index e9f201a1..d0ca2a32 100644 --- a/pyazhpc/azconfig.py +++ b/pyazhpc/azconfig.py @@ -22,7 +22,7 @@ class ConfigFile: json.dump(self.data, f, indent=4) def get_install_from_destination(self): - install_from = self.read_value("install_from", None) + install_from = self.read_value("install_from") dest = install_from if install_from is not None: if self.read_value(f"resources.{install_from}.public_ip", False): @@ -97,13 +97,9 @@ class ConfigFile: else: res = it except KeyError: - if default is not None: - log.debug(f"using default value ({default})") - res = default - else: - log.error("read_value : "+v+" not in config") - sys.exit(1) - + log.debug(f"using default value ({default})") + res = default + log.debug("read_value (exit): "+v+"="+str(res)) return res diff --git a/pyazhpc/azhpc.py b/pyazhpc/azhpc.py index f70b4a8c..21c81167 100644 --- a/pyazhpc/azhpc.py +++ b/pyazhpc/azhpc.py @@ -111,7 +111,7 @@ def do_scp(args): sshkey="{}_id_rsa".format(adminuser) # TODO: check ssh key exists - jumpbox = c.read_value("install_from", None) + jumpbox = c.read_value("install_from") if jumpbox == None: log.error(f"Missing 'install_from' property") sys.exit(1) @@ -148,7 +148,7 @@ def do_connect(args): else: sshuser = args.user - jumpbox = c.read_value("install_from", None) + jumpbox = c.read_value("install_from") if jumpbox == None: log.error(f"Missing 'install_from' property") sys.exit(1) @@ -234,7 +234,7 @@ def do_status(args): adminuser = c.read_value("admin_user") ssh_private_key="{}_id_rsa".format(adminuser) - jumpbox = c.read_value("install_from", None) + jumpbox = c.read_value("install_from") if jumpbox == None: log.error(f"Missing 'install_from' property") sys.exit(1) @@ -260,7 +260,7 @@ def do_run(args): else: sshuser = args.user - jumpbox = c.read_value("install_from", None) + jumpbox = c.read_value("install_from") if jumpbox == None: log.error(f"Missing 'install_from' property") sys.exit(1) @@ -271,7 +271,7 @@ def do_run(args): hosts = [] if args.nodes: for r in args.nodes.split(" "): - rtype = c.read_value(f"resources.{r}.type", None) + rtype = c.read_value(f"resources.{r}.type") if not rtype: log.error(f"resource {r} does not exist in config") sys.exit(1) @@ -420,7 +420,7 @@ def do_build(args): log.info("building install scripts") azinstall.generate_install(config, tmpdir, adminuser, private_key_file, public_key_file) - jumpbox = c.read_value("install_from", None) + jumpbox = c.read_value("install_from") if jumpbox == None: log.info("nothing to install ('install_from' is not set)") else: