From f985799c775e40dfe2d4410aa418e80885d18ee7 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Sun, 7 Mar 2021 09:35:30 +0000 Subject: [PATCH] Avoid exception with empty galaxy files (#1439) --- src/ansiblelint/_prerun.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ansiblelint/_prerun.py b/src/ansiblelint/_prerun.py index 135d2fd350..9e37607d76 100644 --- a/src/ansiblelint/_prerun.py +++ b/src/ansiblelint/_prerun.py @@ -276,6 +276,9 @@ def _perform_mockings() -> None: if not os.path.exists("galaxy.yml"): return yaml = yaml_from_file("galaxy.yml") + if not yaml: + # ignore empty galaxy.yml file + return namespace = yaml.get('namespace', None) collection = yaml.get('name', None) if not namespace or not collection: