Get rid of "status" parameter in run_command
This is the first commit in a refactoring attempt of the SSH/SCP connection code that got abandoned as https://review.openstack.org/#/c/5720/. Let's get rid of "status" parameter, effectively making "run_command" just ignore the return code. This is needed to introduce (*argv, **envp) as more pythonic parameters to "run_command". Change-Id: If6b56e567a04170c406c9f686c7e1aa9cd4230c1
This commit is contained in:
parent
d06c95de55
commit
cb86f2360b
11
git-review
11
git-review
@ -59,7 +59,7 @@ class colors:
|
||||
reset = '\033[0m'
|
||||
|
||||
|
||||
def run_command(cmd, status=False, env={}):
|
||||
def run_command_status(cmd, env={}):
|
||||
if VERBOSE:
|
||||
print(datetime.datetime.now(), "Running:", cmd)
|
||||
cmd_list = shlex.split(str(cmd))
|
||||
@ -69,13 +69,12 @@ def run_command(cmd, status=False, env={}):
|
||||
stderr=subprocess.STDOUT, env=newenv)
|
||||
(out, nothing) = p.communicate()
|
||||
out = out.decode('utf-8')
|
||||
if status:
|
||||
return (p.returncode, out.strip())
|
||||
return out.strip()
|
||||
return (p.returncode, out.strip())
|
||||
|
||||
|
||||
def run_command_status(cmd, env={}):
|
||||
return run_command(cmd, True, env)
|
||||
def run_command(cmd, env={}):
|
||||
(rc, output) = run_command_status(cmd, env)
|
||||
return output
|
||||
|
||||
|
||||
def update_latest_version(version_file_path):
|
||||
|
Loading…
x
Reference in New Issue
Block a user