diff options
author | Matt Goodall <matt.goodall@gmail.com> | 2012-05-23 00:58:05 +0100 |
---|---|---|
committer | Matt Goodall <matt.goodall@gmail.com> | 2012-05-23 00:58:05 +0100 |
commit | 8babac48568f390a1f208e14e88f20d67b3062f4 (patch) | |
tree | 6bf269eb7f88ea058e1bd314b0d1776bcb02a22b | |
parent | 90c70d7c05461fcd379846431f6ca616877dab89 (diff) | |
download | ansible-8babac48568f390a1f208e14e88f20d67b3062f4.tar.gz |
Allow "=" in k-v values.
-rw-r--r-- | lib/ansible/utils.py | 2 | ||||
-rw-r--r-- | test/TestUtils.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py index f10052b0f5..8373a82fc4 100644 --- a/lib/ansible/utils.py +++ b/lib/ansible/utils.py @@ -295,7 +295,7 @@ def parse_kv(args): vargs = shlex.split(args, posix=True) for x in vargs: if x.find("=") != -1: - k, v = x.split("=") + k, v = x.split("=", 1) options[k]=v return options diff --git a/test/TestUtils.py b/test/TestUtils.py index 114ac71c0a..7d03e17c47 100644 --- a/test/TestUtils.py +++ b/test/TestUtils.py @@ -235,3 +235,10 @@ class TestUtils(unittest.TestCase): res = ansible.utils.template(template, vars, {}, no_engine=False) assert res == u'hello wórld' + + ##################################### + ### key-value parsing + + def test_parse_kv_basic(self): + assert (ansible.utils.parse_kv('a=simple b="with space" c="this=that"') == + {'a': 'simple', 'b': 'with space', 'c': 'this=that'}) |