Skip to content

Commit

Permalink
Don't NameError if there is no notify keyword to update
Browse files Browse the repository at this point in the history
  • Loading branch information
Qalthos committed Apr 15, 2024
1 parent 0d040b7 commit 9b11437
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/ansiblelint/rules/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ def update_task_name(task_name: str) -> str:
for item in data:
if isinstance(item, dict) and "tasks" in item:
for task in item["tasks"]:
# We want to rewrite task names in the notify keyword,
# but if there isn't one, we don't need to do anything.
if "notify" not in task:
continue

Check warning on line 197 in src/ansiblelint/rules/name.py

View check run for this annotation

Codecov / codecov/patch

src/ansiblelint/rules/name.py#L197

Added line #L197 was not covered by tests

if (
isinstance(task["notify"], str)
and orig_task_name == task["notify"]
Expand Down
4 changes: 2 additions & 2 deletions src/ansiblelint/schemas/__store__.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/execution-environment.json"
},
"galaxy": {
"etag": "2a8e7fa2a186af391ad599f90dac7a4b7705e803f4ea3b7e4b3b8c334462b1ac",
"etag": "4224ac235cc5657bf77b5834cea48b4d573cc8b666694f788590e213adfb8113",
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/galaxy.json"
},
"inventory": {
"etag": "b52c251a121e2e807928db7b4e09338babde9e74a50d0f74e8908f6e230d101d",
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json"
},
"meta": {
"etag": "54b5e8c779eb0959619335dcb4d04824bbe0036e5f2bf50b581ea5ed77fd2644",
"etag": "fdff861b226b13b711dd7f94301ed5becd6dc5d8d4e872f909d4a3d8133d600a",
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta.json"
},
"meta-runtime": {
Expand Down

0 comments on commit 9b11437

Please sign in to comment.