From ca5e1bd0489a4951768bad3b27b886e174ffff66 Mon Sep 17 00:00:00 2001 From: Guy Elkayam Date: Sun, 27 Oct 2024 17:43:23 +0200 Subject: [PATCH] Avoid WARN on empty/template meta/main.yaml WARNING Ignored exception from RoleNames.matchyaml while processing roles/xxx/meta/main.yaml (meta): 'NoneType' object has no attribute 'get' --- src/ansiblelint/rules/role_name.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansiblelint/rules/role_name.py b/src/ansiblelint/rules/role_name.py index ebe0b1a179..9ecbe1903f 100644 --- a/src/ansiblelint/rules/role_name.py +++ b/src/ansiblelint/rules/role_name.py @@ -95,7 +95,7 @@ def matchyaml(self, file: Lintable) -> list[MatchError]: if file.kind not in ("meta", "role", "playbook"): return result - if file.kind == "meta": + if file.kind == "meta" and file.data: for role in file.data.get("dependencies", []): if isinstance(role, dict): role_name = role["role"]