Commit 29e110a2 authored by Niklas Hambuechen's avatar Niklas Hambuechen Committed by Hrvoje Ribicic

qa_utils: Allow passing fail=None to AssertCommand

This is for cases where we don't care about the exit code.
Signed-off-by: default avatarNiklas Hambuechen <niklash@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>

Cherry-picked-from: 226455dfSigned-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 77292586
......@@ -155,8 +155,9 @@ def AssertCommand(cmd, fail=False, node=None, log_cmd=True, max_seconds=None):
@param cmd: either a string (the command to execute) or a list (to
be converted using L{utils.ShellQuoteArgs} into a string)
@type fail: boolean
@param fail: if the command is expected to fail instead of succeeding
@type fail: boolean or None
@param fail: if the command is expected to fail instead of succeeding,
or None if we don't care
@param node: if passed, it should be the node on which the command
should be executed, instead of the master node (can be either a
dict or a string)
......@@ -185,7 +186,8 @@ def AssertCommand(cmd, fail=False, node=None, log_cmd=True, max_seconds=None):
stdout, stderr = popen.communicate()
rcode = popen.returncode
duration_seconds = TimedeltaToTotalSeconds(datetime.datetime.now() - start)
_AssertRetCode(rcode, fail, cmdstr, nodename)
if fail is not None:
_AssertRetCode(rcode, fail, cmdstr, nodename)
if max_seconds is not None:
if duration_seconds > max_seconds:
......
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