From 2aaecc5afae1ed7138d82fc225554880afb0a96f Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Wed, 19 Mar 2014 13:49:31 -0500 Subject: [PATCH] Fix logic in process_common_errors for unbalanced quotes --- lib/ansible/utils/__init__.py | 2 +- test/units/TestUtils.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 2d3fb24db3..d3c9d2e15c 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -424,7 +424,7 @@ Or: match = True elif middle.startswith('"') and not middle.endswith('"'): match = True - if len(middle) > 0 and middle[0] in [ '"', "'" ] and middle[-1] in [ '"', "'" ] and probline.count("'") > 2 or probline.count("'") > 2: + if len(middle) > 0 and middle[0] in [ '"', "'" ] and middle[-1] in [ '"', "'" ] and probline.count("'") > 2 or probline.count('"') > 2: unbalanced = True if match: msg = msg + """ diff --git a/test/units/TestUtils.py b/test/units/TestUtils.py index 9755327100..85564c96cc 100644 --- a/test/units/TestUtils.py +++ b/test/units/TestUtils.py @@ -301,8 +301,7 @@ class TestUtils(unittest.TestCase): self.assertTrue('same kind of quote' in ansible.utils.process_common_errors('', "foo: '{{bar}}'baz", 6)) # unbalanced - # The first test fails and is commented out for now, logic is wrong and the test fails - #self.assertTrue('We could be wrong' in ansible.utils.process_common_errors('', 'foo: "bad" "wolf"', 6)) + self.assertTrue('We could be wrong' in ansible.utils.process_common_errors('', 'foo: "bad" "wolf"', 6)) self.assertTrue('We could be wrong' in ansible.utils.process_common_errors('', "foo: 'bad' 'wolf'", 6))