summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/util.py6
-rw-r--r--morphlib/util_tests.py5
2 files changed, 10 insertions, 1 deletions
diff --git a/morphlib/util.py b/morphlib/util.py
index 7526c93c..22288cac 100644
--- a/morphlib/util.py
+++ b/morphlib/util.py
@@ -361,7 +361,6 @@ def parse_environment_pairs(env, pairs):
return dict(env.items() + extra_env.items())
-
def get_host_architecture(): # pragma: no cover
'''Get the canonical Morph name for the host's architecture.'''
@@ -381,3 +380,8 @@ def get_host_architecture(): # pragma: no cover
raise morphlib.Error('Unknown host architecture %s' % machine)
return table[machine]
+
+
+def sanitize_environment(env):
+ for k in env:
+ env[k] = str(env[k])
diff --git a/morphlib/util_tests.py b/morphlib/util_tests.py
index ca9fe5ae..2ad9e8aa 100644
--- a/morphlib/util_tests.py
+++ b/morphlib/util_tests.py
@@ -105,3 +105,8 @@ class ParseEnvironmentPairsTests(unittest.TestCase):
morphlib.util.parse_environment_pairs,
{"foo": "bar"},
["foo=bar"])
+
+ def test_sanitize_environment(self):
+ d = { 'a': 1 }
+ morphlib.util.sanitize_environment(d)
+ self.assertTrue(isinstance(d['a'], str))