Revision 5d831182 qa/qa_utils.py
b/qa/qa_utils.py | ||
---|---|---|
122 | 122 |
args.append(node) |
123 | 123 |
args.append(cmd) |
124 | 124 |
|
125 |
print 'SSH:', utils.ShellQuoteArgs(args) |
|
126 |
|
|
127 | 125 |
return args |
128 | 126 |
|
129 | 127 |
|
128 |
def StartLocalCommand(cmd, **kwargs): |
|
129 |
"""Starts a local command. |
|
130 |
|
|
131 |
""" |
|
132 |
print "Command: %s" % utils.ShellQuoteArgs(cmd) |
|
133 |
return subprocess.Popen(cmd, shell=False, **kwargs) |
|
134 |
|
|
135 |
|
|
130 | 136 |
def StartSSH(node, cmd, strict=True): |
131 | 137 |
"""Starts SSH. |
132 | 138 |
|
133 | 139 |
""" |
134 |
return subprocess.Popen(GetSSHCommand(node, cmd, strict=strict), |
|
135 |
shell=False) |
|
140 |
return StartLocalCommand(GetSSHCommand(node, cmd, strict=strict)) |
|
136 | 141 |
|
137 | 142 |
|
138 | 143 |
def GetCommandOutput(node, cmd): |
139 | 144 |
"""Returns the output of a command executed on the given node. |
140 | 145 |
|
141 | 146 |
""" |
142 |
p = subprocess.Popen(GetSSHCommand(node, cmd), |
|
143 |
shell=False, stdout=subprocess.PIPE) |
|
147 |
p = StartLocalCommand(GetSSHCommand(node, cmd), stdout=subprocess.PIPE) |
|
144 | 148 |
AssertEqual(p.wait(), 0) |
145 | 149 |
return p.stdout.read() |
146 | 150 |
|
Also available in: Unified diff