Remove regex related to baby-JSON parsing only.

pull/8805/merge
Michael DeHaan 10 years ago
parent 22dbb65b13
commit d6e6d2a6ca

@ -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()

@ -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)

Loading…
Cancel
Save