Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for issue 31 - taskmatch ends exclude block #32

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,28 @@
enabled: false
state: stopped
masked: true

---
# issue #31
- name: test file 1
file:
path: /a/b/c/1

- name: command with vars 1
command: echo "before file 2"
vars:
ansible_ssh_pipelining: true

- name: test file 2
file:
path: /a/b/c/2

- name: command with vars 2
vars:
ansible_ssh_pipelining: true
command: echo "before file 3"

- name: test file 3
file:
path: /a/b/c/3
# end issue #31
25 changes: 25 additions & 0 deletions exampleconverted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,28 @@
enabled: false
state: stopped
masked: true

---
# issue #31
- name: test file 1
ansible.builtin.file:
path: /a/b/c/1

- name: command with vars 1
ansible.builtin.command: echo "before file 2"
vars:
ansible_ssh_pipelining: true

- name: test file 2
ansible.builtin.file:
path: /a/b/c/2

- name: command with vars 2
vars:
ansible_ssh_pipelining: true
ansible.builtin.command: echo "before file 3"

- name: test file 3
ansible.builtin.file:
path: /a/b/c/3
# end issue #31
7 changes: 6 additions & 1 deletion fqcn-fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ def increase_indent(self, flow=False, *dargs, **dkwargs): # pylint: disable=keyw
if args.printdiff:
originallines.append(line)
nline = line
taskmatch = _taskstartregex.match(line)
if checkstartexcludeblock(line):
in_ignore_block = True
startingwhitespaces_ignore_block = re.match(r'\s*-?\s*', line).group()
Expand All @@ -398,11 +399,15 @@ def increase_indent(self, flow=False, *dargs, **dkwargs): # pylint: disable=keyw
startingwhitespaces_ignore_block = None
if args.debug:
debugmsg('end exclude block!')
elif taskmatch:
in_ignore_block = False
startingwhitespaces_ignore_block = None
if args.debug:
debugmsg('taskmatch in exclude block => end exclude block!')
else:
if args.debug:
debugmsg('... in exclude block ... ignore line')
if not in_ignore_block:
taskmatch = _taskstartregex.match(line)
if taskmatch:
if args.debug:
debugmsg('taskmatch: %s' % taskmatch)
Expand Down
Loading