From: Tony Mack Date: Wed, 2 Apr 2008 23:03:48 +0000 (+0000) Subject: move verbose check here X-Git-Tag: tests-4.2-4~98 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=9c250f49fda7d8ef67b65668e62264e0f5755d14;p=tests.git move verbose check here --- diff --git a/qaapi/qa/utils.py b/qaapi/qa/utils.py index 0e5a5a6..89854e1 100644 --- a/qaapi/qa/utils.py +++ b/qaapi/qa/utils.py @@ -10,8 +10,9 @@ def header(message): print output print >> logfile, output - -def popen(command, fatal=True): +def popen(command, fatal=True, verbose = False): + if verbose: + header(command) (stdin, stdout, stderr) = os.popen3(command) output = stdout.readlines() print >> logfile, "+ "+command @@ -24,12 +25,16 @@ def popen(command, fatal=True): raise Exception, "".join(errors) return (output, errors) -def popen3(command): +def popen3(command, verbose = False): + if verbose: + header(command) (stdin, stdout, stderr) = os.popen3(command) print >> logfile, "+ "+command return (stdin, stdout, stderr) -def commands(command, fatal = True): +def commands(command, fatal = True, verbose = False): + if verbose: + header(command) (status, output) = getstatusoutput(command) print >> logfile, "+ "+command print >> logfile, output.strip()