Commit 02715459 authored by Iustin Pop's avatar Iustin Pop
Browse files

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
parent 8bd562f5
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment