From 027154593c1435a181a3bf99696043fd1e49feb6 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 23 Aug 2007 13:59:11 +0000 Subject: [PATCH] Improve LURunClusterCommand This function used a hand-coded ssh call to remote nodes. Fix it to use the ssh.SSHCall function, and in the process drop the command field from the results, as it's too verbose and we can use (in gnt-cluster) what we passed in. Reviewed-by: schreiberal --- lib/cmdlib.py | 4 ++-- scripts/gnt-cluster | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 669433e85..04122f4d1 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -1638,8 +1638,8 @@ class LURunClusterCommand(NoHooksLU): """ data = [] for node in self.nodes: - result = utils.RunCmd(["ssh", node.name, self.op.command]) - data.append((node.name, result.cmd, result.output, result.exit_code)) + result = ssh.SSHCall(node.name, "root", self.op.command) + data.append((node.name, result.output, result.exit_code)) return data diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index 5e6963366..171f5f5c8 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -140,10 +140,9 @@ def RunClusterCommand(opts, args): nodes = opts.nodes op = opcodes.OpRunClusterCommand(command=command, nodes=nodes) result = SubmitOpCode(op) - for node, sshcommand, output, exit_code in result: + for node, output, exit_code in result: print ("------------------------------------------------") print ("node: %s" % node) - print ("command: %s" % sshcommand) print ("%s" % output) print ("return code = %s" % exit_code) -- GitLab