From d6e6d2a6cac561bdcad1a1aa248cfb3fe1dec133 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 11 Sep 2014 13:29:59 -0400 Subject: [PATCH] Remove regex related to baby-JSON parsing only. --- lib/ansible/utils/__init__.py | 3 +-- test/units/TestUtils.py | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 861053da20d..6da1f9a0301 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -1129,11 +1129,10 @@ def filter_leading_non_json_lines(buf): filter only leading lines since multiline JSON is valid. ''' - kv_regex = re.compile(r'\w=\w') filtered_lines = StringIO.StringIO() stop_filtering = False for line in buf.splitlines(): - if stop_filtering or line.startswith('{') or line.startswith('[') or kv_regex.search(line): + if stop_filtering or line.startswith('{') or line.startswith('['): stop_filtering = True filtered_lines.write(line + '\n') return filtered_lines.getvalue() diff --git a/test/units/TestUtils.py b/test/units/TestUtils.py index 58535f0488f..73ef9796743 100644 --- a/test/units/TestUtils.py +++ b/test/units/TestUtils.py @@ -453,8 +453,6 @@ class TestUtils(unittest.TestCase): '{"foo": "bar"}\n') self.assertEqual(ansible.utils.filter_leading_non_json_lines('a\nb\nansible!\n["foo", "bar"]'), '["foo", "bar"]\n') - self.assertEqual(ansible.utils.filter_leading_non_json_lines('a\nb\nansible!\nfoo=bar'), - 'foo=bar\n') def test_boolean(self): self.assertEqual(ansible.utils.boolean("true"), True)