summaryrefslogtreecommitdiffstats
path: root/base/common/python
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2017-04-11 23:04:34 -0400
committerAde Lee <alee@redhat.com>2017-04-13 10:31:23 -0400
commit7672b543f8c62da34f0bb11be17d5e6d336cb2da (patch)
tree0dcd62332a2c6de52d82a0e54e0e9d4a7556ffb3 /base/common/python
parent164087b1fc302dd8b125cd52e9e55f54ea97e09d (diff)
downloadpki-7672b543f8c62da34f0bb11be17d5e6d336cb2da.tar.gz
pki-7672b543f8c62da34f0bb11be17d5e6d336cb2da.tar.xz
pki-7672b543f8c62da34f0bb11be17d5e6d336cb2da.zip
Fix python issues identified in review
subprocess returns bytes in Python 3. Make sure to decode first when returning env variables. Change-Id: I225044c0463f0a84ac5ffb77b28391fac269598d
Diffstat (limited to 'base/common/python')
-rw-r--r--base/common/python/pki/util.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/base/common/python/pki/util.py b/base/common/python/pki/util.py
index 0de13fd93..5832f5562 100644
--- a/base/common/python/pki/util.py
+++ b/base/common/python/pki/util.py
@@ -258,10 +258,9 @@ def read_environment_files(env_file_list=None):
if env_file_list is None:
env_file_list = DEFAULT_PKI_ENV_LIST
- file_command = ''
- for env_file in env_file_list:
- file_command += "source " + env_file + " && "
- file_command += "env"
+ file_command = ' && '.join(
+ 'source {}'.format(env_file) for env_file in env_file_list)
+ file_command += ' && env'
command = [
'bash',
@@ -269,7 +268,7 @@ def read_environment_files(env_file_list=None):
file_command
]
- env_vals = subprocess.check_output(command).split('\n')
+ env_vals = subprocess.check_output(command).decode('utf-8').split('\n')
for env_val in env_vals:
(key, _, value) = env_val.partition("=")