Merge "Address python3 string issues with subprocess"

This commit is contained in:
Zuul 2018-08-21 10:50:39 +00:00 committed by Gerrit Code Review
commit 46ae1d04f3
3 changed files with 10 additions and 5 deletions

View File

@ -143,7 +143,8 @@ class HeatBaseLauncher(object):
p = subprocess.Popen(['mount', '-t', 'tmpfs', '-o', 'size=500M',
'tmpfs', heatdir],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stderr=subprocess.PIPE,
universal_newlines=True)
cmd_stdout, cmd_stderr = p.communicate()
retval = p.returncode
if retval != 0:
@ -273,7 +274,8 @@ class HeatDockerLauncher(HeatBaseLauncher):
'getent', 'passwd', self.user
]
log.debug(' '.join(cmd))
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
universal_newlines=True)
result = p.communicate()[0]
if result:
return result.split(':')[2]
@ -286,7 +288,8 @@ class HeatDockerLauncher(HeatBaseLauncher):
'getent', 'group', self.user
]
log.debug(' '.join(cmd))
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
universal_newlines=True)
result = p.communicate()[0]
if result:
return result.split(':')[2]

View File

@ -1056,7 +1056,8 @@ def get_short_hostname():
:return string
"""
p = subprocess.Popen(["hostname", "-s"], stdout=subprocess.PIPE)
p = subprocess.Popen(["hostname", "-s"], stdout=subprocess.PIPE,
universal_newlines=True)
return p.communicate()[0].rstrip()

View File

@ -77,7 +77,8 @@ def _run_live_command(args, env=None, name=None, cwd=None, wait=True):
name = args[0]
process = subprocess.Popen(args, env=env, cwd=cwd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stderr=subprocess.STDOUT,
universal_newlines=True)
if not wait:
return process