Merge "Remove whitespace before comments"

This commit is contained in:
Zuul 2019-02-21 09:35:14 +00:00 committed by Gerrit Code Review
commit c391bd0351
3 changed files with 5 additions and 2 deletions

View File

@ -216,8 +216,8 @@ class ConfigTemplateParser(ConfigParser.RawConfigParser):
comments.append('')
continue
if line[0] in '#;':
comments.append(line)
if line.lstrip()[0] in '#;':
comments.append(line.lstrip())
continue
if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR":

View File

@ -1,3 +1,4 @@
# This comment tests bug 1755821
# A default section comment
# broken into multiple lines
[DEFAULT]

View File

@ -239,6 +239,8 @@
that:
- "(lookup('ini', 'new_key section=DEFAULT file=/tmp/test_with_comments.ini')) == 'new_value'"
- "(lookup('ini', 'baz section=foo file=/tmp/test_with_comments.ini')) == 'bar'"
- "{{ ini_file.content | b64decode | search('# This comment tests bug 1755821')}}"
- "{{ not(ini_file.content | b64decode | search(' # This comment tests bug 1755821'))}}"
- "{{ ini_file.content | b64decode | search('#This is a comment')}}"
- "{{ ini_file.content | b64decode | search('# A default section comment\n# broken into multiple lines\n\\[DEFAULT\\]')}}"