Fix py3 issue in get_undercloud_registry()

In python3 subprocess returns <class 'bytes'> type,
in python2 this was <type 'str'>. Add universal_newlines
argument to subprocess.Popen() call to ensure we get a
string.

Related: RHBZ#1762303
Closes-Bug: #1849140
Change-Id: I6fb51796d6c6b2efa82a0e96fa954f479a1641f2
This commit is contained in:
Harald Jensås 2019-10-21 16:58:53 +02:00
parent d384320b13
commit 195ce10a2e
1 changed files with 2 additions and 1 deletions

View File

@ -101,7 +101,8 @@ def get_undercloud_registry():
ctlplane_hostname = '.'.join([socket.gethostname().split('.')[0],
'ctlplane'])
cmd = ['getent', 'hosts', ctlplane_hostname]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
universal_newlines=True)
out, err = process.communicate()
if process.returncode != 0: