diff options
Diffstat (limited to 'clusterman/commands/node.py')
| -rw-r--r-- | clusterman/commands/node.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clusterman/commands/node.py b/clusterman/commands/node.py index 087f0df..1b800d2 100644 --- a/clusterman/commands/node.py +++ b/clusterman/commands/node.py @@ -89,7 +89,13 @@ def check(timeout): print("Error: Some of your nodes are not reachable") def exec(command): - print(["ssh", "-i", CONF["ssh_key_path"], command]) + user="root" if len(CONF["ssh"]["user"]) <= 0 else CONF["ssh"]["user"] + key_path=CONF["ssh"]["key_path"] for ip in get_node_list(): print("----- Node {} -----".format(ip)) - subprocess.run(["ssh","-o", "StrictHostKeyChecking=no", "-i", CONF["ssh_key_path"],"root@"+ip, " ".join(command)]) + if len(key_path)>0: + # subprocess.run(["ssh","-o", "StrictHostKeyChecking=no", "-i", CONF["ssh_key_path"],"{}@{}".format(user,ip), " ".join(command)]) + print(["ssh","-o", "StrictHostKeyChecking=no", "-i", CONF["ssh_key_path"],"{}@{}".format(user,ip), " ".join(command)]) + else: +# subprocess.run(["ssh","-o", "StrictHostKeyChecking=no", "{}@{}".format(user,ip), " ".join(command)]) + print(["ssh","-o", "StrictHostKeyChecking=no", "{}@{}".format(user,ip), " ".join(command)]) |
