summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sfc/lib/utils.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index 13f534be..032dcfd3 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -27,25 +27,19 @@ FUNCTEST_RESULTS_DIR = os.path.join("home", "opnfv",
"functest", "results", "odl-sfc")
-def run_cmd(cmd, wdir=None, ignore_stderr=False, ignore_no_output=True):
+def run_cmd(cmd):
"""run given command locally and return commands output if success"""
pipe = subprocess.Popen(cmd, shell=True,
- stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, cwd=wdir)
+ stderr=subprocess.PIPE)
(output, errors) = pipe.communicate()
if output:
output = output.strip()
- if pipe.returncode < 0:
+ if pipe.returncode != 0 or len(errors) > 0:
+ logger.error('FAILED to execute {0}'.format(cmd))
logger.error(errors)
- return False
- if errors:
- logger.error(errors)
- return ignore_stderr
-
- if ignore_no_output and not output:
- return True
+ return None
return output