From 6d94ae64ec650bddb754e0e7686496ddc517a3d5 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 4 Aug 2014 09:43:08 -0500 Subject: [PATCH] Remove unnecessary unicode conversions from parse_kv Fixes #8425 --- lib/ansible/runner/__init__.py | 1 - lib/ansible/utils/__init__.py | 3 --- test/integration/unicode.yml | 1 + test/units/TestUtils.py | 2 ++ 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 980254f644..db3e308e05 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -31,7 +31,6 @@ import sys import pipes import jinja2 import subprocess -import shlex import getpass import ansible.constants as C diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index a1880b07c4..83b80ab885 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -694,8 +694,6 @@ def parse_kv(args): ''' convert a string of key/value items to a dict ''' options = {} if args is not None: - # attempting to split a unicode here does bad things - args = args.encode('utf-8') try: vargs = split_args(args) except ValueError, ve: @@ -703,7 +701,6 @@ def parse_kv(args): raise errors.AnsibleError("error parsing argument string, try quoting the entire line.") else: raise - vargs = [x.decode('utf-8') for x in vargs] for x in vargs: if "=" in x: k, v = x.split("=",1) diff --git a/test/integration/unicode.yml b/test/integration/unicode.yml index eea6293dc2..69c737a8a3 100644 --- a/test/integration/unicode.yml +++ b/test/integration/unicode.yml @@ -40,3 +40,4 @@ gather_facts: true tasks: - debug: msg='Unicode is a good thing ™' + - debug: msg=АБВГД diff --git a/test/units/TestUtils.py b/test/units/TestUtils.py index be99292051..935da0ff8f 100644 --- a/test/units/TestUtils.py +++ b/test/units/TestUtils.py @@ -165,6 +165,8 @@ class TestUtils(unittest.TestCase): def test_parse_kv_basic(self): self.assertEqual(ansible.utils.parse_kv('a=simple b="with space" c="this=that"'), {'a': 'simple', 'b': 'with space', 'c': 'this=that'}) + self.assertEqual(ansible.utils.parse_kv('msg=АБВГД'), + {'msg': 'АБВГД'}) def test_jsonify(self):