summaryrefslogtreecommitdiff
path: root/clusterman/commands/node.py
diff options
context:
space:
mode:
Diffstat (limited to 'clusterman/commands/node.py')
-rw-r--r--clusterman/commands/node.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/clusterman/commands/node.py b/clusterman/commands/node.py
index 6a32fb1..59fbdc5 100644
--- a/clusterman/commands/node.py
+++ b/clusterman/commands/node.py
@@ -83,10 +83,11 @@ def check(timeout):
else:
print("Error: Some of your nodes are not reachable")
-def exec(command):
+def exec(command, group=None):
user="root" if len(CONF["ssh"]["user"]) <= 0 else CONF["ssh"]["user"]
key_path=CONF["ssh"]["key_path"]
- for ip in get_node_list():
+ nodes=get_node_list() if group is None else get_node_in_group(group)
+ for ip in nodes:
print("----- Node {} -----".format(ip))
if len(key_path)>0:
output=subprocess.check_output(["ssh","-o", "StrictHostKeyChecking=no", "-i", CONF["ssh"]["key_path"],"{}@{}".format(user,ip), " ".join(command)])