From 9b11437b944d1089fca78cfc5ac7279ce405d9e0 Mon Sep 17 00:00:00 2001 From: Kate Case Date: Mon, 15 Apr 2024 10:23:27 -0400 Subject: [PATCH] Don't NameError if there is no notify keyword to update --- src/ansiblelint/rules/name.py | 5 +++++ src/ansiblelint/schemas/__store__.json | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ansiblelint/rules/name.py b/src/ansiblelint/rules/name.py index 2f1f87006e..46c9654a5c 100644 --- a/src/ansiblelint/rules/name.py +++ b/src/ansiblelint/rules/name.py @@ -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 + if ( isinstance(task["notify"], str) and orig_task_name == task["notify"] diff --git a/src/ansiblelint/schemas/__store__.json b/src/ansiblelint/schemas/__store__.json index 607366939c..8387834a37 100644 --- a/src/ansiblelint/schemas/__store__.json +++ b/src/ansiblelint/schemas/__store__.json @@ -16,7 +16,7 @@ "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": { @@ -24,7 +24,7 @@ "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": {