Revision afd5ca04 qa/qa_utils.py
b/qa/qa_utils.py | ||
---|---|---|
55 | 55 |
#: Unique ID per QA run |
56 | 56 |
_RUN_UUID = utils.NewUUID() |
57 | 57 |
|
58 |
#: Path to the QA query output log file |
|
59 |
_QA_OUTPUT = pathutils.GetLogFilename("qa-output") |
|
60 |
|
|
58 | 61 |
|
59 | 62 |
(INST_DOWN, |
60 | 63 |
INST_UP) = range(500, 502) |
... | ... | |
192 | 195 |
return rcode |
193 | 196 |
|
194 | 197 |
|
198 |
def AssertRedirectedCommand(cmd, fail=False, node=None, log_cmd=True): |
|
199 |
"""Executes a command with redirected output. |
|
200 |
|
|
201 |
The log will go to the qa-output log file in the ganeti log |
|
202 |
directory on the node where the command is executed. The fail and |
|
203 |
node parameters are passed unchanged to AssertCommand. |
|
204 |
|
|
205 |
@param cmd: the command to be executed, as a list; a string is not |
|
206 |
supported |
|
207 |
|
|
208 |
""" |
|
209 |
if not isinstance(cmd, list): |
|
210 |
raise qa_error.Error("Non-list passed to AssertRedirectedCommand") |
|
211 |
ofile = utils.ShellQuote(_QA_OUTPUT) |
|
212 |
cmdstr = utils.ShellQuoteArgs(cmd) |
|
213 |
AssertCommand("echo ---- $(date) %s ---- >> %s" % (cmdstr, ofile), |
|
214 |
fail=False, node=node, log_cmd=False) |
|
215 |
return AssertCommand(cmdstr + " >> %s" % ofile, |
|
216 |
fail=fail, node=node, log_cmd=log_cmd) |
|
217 |
|
|
218 |
|
|
195 | 219 |
def GetSSHCommand(node, cmd, strict=True, opts=None, tty=None): |
196 | 220 |
"""Builds SSH command to be executed. |
197 | 221 |
|
Also available in: Unified diff