summaryrefslogtreecommitdiffstats
path: root/yardstick/common/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/common/utils.py')
-rw-r--r--yardstick/common/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index 357f66be8..44cc92a7c 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -136,6 +136,11 @@ def source_env(env_file):
p = subprocess.Popen(". %s; env" % env_file, stdout=subprocess.PIPE,
shell=True)
output = p.communicate()[0]
+
+ # sometimes output type would be binary_type, and it don't have splitlines
+ # method, so we need to decode
+ if isinstance(output, six.binary_type):
+ output = encodeutils.safe_decode(output)
env = dict(line.split('=', 1) for line in output.splitlines() if '=' in line)
os.environ.update(env)
return env