diff --git a/clusterman/utils.py b/clusterman/utils.py index c11883d..8c24498 100755 --- a/clusterman/utils.py +++ b/clusterman/utils.py @@ -4,7 +4,7 @@ from clusterman.config import CONF def ssh_exec(host,command,use_key=True): user="root" if len(CONF["ssh"]["user"]) <= 0 else CONF["ssh"]["user"] key_path=CONF["ssh"]["key_path"] - if use_key: + if use_key and len(key_path) > 0: output=subprocess.check_output(["ssh","-o", "StrictHostKeyChecking=no", "-o", "PasswordAuthentication=no", "-i", CONF["ssh"]["key_path"],"{}@{}".format(user,host), command]) return output.decode("utf-8") else: