Skip to content
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
7 changes: 7 additions & 0 deletions examples/playbooks/no_handler_fail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@
when:
- result['changed'] == true
- another_condition

- name: This should be a handler 6
ansible.builtin.debug:
msg: why isn't this a handler
when:
- first_condition
- result.changed
5 changes: 3 additions & 2 deletions src/ansiblelint/rules/no_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def matchtask(

if isinstance(when, list):
for item in when:
return _changed_in_when(item)
if _changed_in_when(item):
return True
if isinstance(when, str):
return _changed_in_when(when)
return False
Expand All @@ -90,7 +91,7 @@ def matchtask(
@pytest.mark.parametrize(
("test_file", "failures"),
(
pytest.param("examples/playbooks/no_handler_fail.yml", 6, id="fail"),
pytest.param("examples/playbooks/no_handler_fail.yml", 7, id="fail"),
pytest.param("examples/playbooks/no_handler_pass.yml", 0, id="pass"),
),
)
Expand Down