X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=deploy%2Fcommon.py;h=bc27876173b2f4ae70387e0c268bab9e32249137;hb=refs%2Fchanges%2F47%2F6547%2F2;hp=17fd2174a6f7e667930559aed99fd5b61bd5c9f3;hpb=24a95306d2564b272b5320e9149d9aea70b4061c;p=fuel.git diff --git a/deploy/common.py b/deploy/common.py index 17fd2174a..bc2787617 100644 --- a/deploy/common.py +++ b/deploy/common.py @@ -39,16 +39,23 @@ LOG.addHandler(out_handler) os.chmod(LOGFILE, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) def exec_cmd(cmd, check=True): + nul_f = open(os.devnull, 'w') process = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, + stderr=nul_f, shell=True) + nul_f.close() response = process.communicate()[0].strip() return_code = process.returncode if check: if return_code > 0: + print "Failed command: " + str(cmd) + print "Command returned response: " + str(response) + print "Command return code: " + str(return_code) raise Exception(response) else: + print "Command: " + str(cmd) + print str(response) return response return response, return_code