Address python3 string issues with subprocess

Follows up Id0060a3abbcda8edb6124eb096cb824aaea48396.
This patch updates our Popen calls to enable universal newlines for
calls that we parse or consume the output for. Without
univeral_newlines=True, the output is treated as bytes under python3
which leads to issues later where we are using it as strings.

See https://docs.python.org/3/glossary.html#term-universal-newlines
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>

Change-Id: I5d8c5c03c5428d7af9a28cabfe4c9363ce435d1a
This commit is contained in:
Bogdan Dobrelya 2019-01-23 16:13:46 +01:00
parent 1f642a93ef
commit 9c61b5aa36

View File

@ -120,7 +120,8 @@ class HeatBaseLauncher(object):
# This one may fail but it's just cleanup.
p = subprocess.Popen(['umount', 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: