fix: ensure galaxy_info is top-level key in meta file

This commit is contained in:
Robert Kaussow 2021-01-31 13:33:57 +01:00
parent e90b80f12f
commit 4278df2848
Signed by: xoxys
GPG Key ID: 65362AE74AF98B61
1 changed files with 5 additions and 1 deletions

View File

@ -16,8 +16,12 @@ class CheckMetaMain(StandardBase):
keys = ["author", "description", "min_ansible_version", "platforms", "dependencies"]
if not errors:
has_galaxy_info = (isinstance(content, dict) and "galaxy_info" in content.keys())
if not has_galaxy_info:
errors.append(self.Error(None, self.helptext.format(key="galaxy_info")))
for key in keys:
if not nested_lookup(key, content):
if has_galaxy_info and not nested_lookup(key, content.get("galaxy_info", {})):
errors.append(self.Error(None, self.helptext.format(key=key)))
return self.Result(candidate.path, errors)