Skip to content

Commit

Permalink
Fix ci issues
Browse files Browse the repository at this point in the history
  • Loading branch information
audgirka committed Sep 27, 2023
1 parent 3c0361b commit 7aa6530
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ansiblelint/rules/no_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def matchtask(
result = _changed_in_when(when)
return result

# pylint: disable=too-many-nested-blocks,too-many-locals
def transform(
self,
match: MatchError,
Expand Down Expand Up @@ -132,20 +133,21 @@ def transform(
notify_seq = CommentedSeq()
notify_seq.append(old_val)
notify_seq.append(task_name)
v.insert(len(v), "notify", notify_seq)

res = clean_comment(v.ca.items)
for key, value in res.items():
if not value.get("val", None):
v.ca.items.pop(key)
elif value.get("move"):
v.ca.items.pop(key)
item.get("tasks").yaml_set_comment_before_after_key(
k + 1, value.get("val")
k + 1,
value.get("val"),
)
else:
v.ca.items[key][2].value = value.get("val", None)

v.insert(len(v), "notify", notify_seq)

if v["name"] == task_name:
item["handlers"].append(item.get("tasks").pop(k))
is_fixed = True
Expand Down

0 comments on commit 7aa6530

Please sign in to comment.