Address python3 string issues with subprocess

This patch updates our Popen call to enable
newlines for calls that we parse or consume the output for.
Without universal_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

Story: 2006796
Task:  42712

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: Ib9f6e9e9bb6ba465993f0ffa4579e86c52716190
This commit is contained in:
Charles Short 2021-06-28 09:37:13 -04:00
parent 1bf6946612
commit 496ce74455
1 changed files with 2 additions and 1 deletions

View File

@ -106,7 +106,8 @@ class OpenstackBaseHelm(base.BaseHelm):
if pw_format == common.PASSWORD_FORMAT_CEPH:
try:
cmd = ['ceph-authtool', '--gen-print-key']
password = subprocess.check_output(cmd).strip()
password = subprocess.check_output(cmd,
universal_newlines=True).strip()
except subprocess.CalledProcessError:
raise exception.SysinvException(
'Failed to generate ceph key')