Improve LURunClusterCommand
authorIustin Pop <iustin@google.com>
Thu, 23 Aug 2007 13:59:11 +0000 (13:59 +0000)
committerIustin Pop <iustin@google.com>
Thu, 23 Aug 2007 13:59:11 +0000 (13:59 +0000)
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
scripts/gnt-cluster

index 669433e..04122f4 100644 (file)
@@ -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
 
index 5e69633..171f5f5 100755 (executable)
@@ -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)