From a65e22fc31d123f3fc195139bfc79d4edd488400 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 27 Oct 2023 13:23:06 +0200 Subject: Minor changes --- clusterman/commands/node.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'clusterman/commands') 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)]) -- cgit v1.2.3