fix dependencies check in CheckMetaMain

This commit is contained in:
Robert Kaussow 2021-02-04 21:08:38 +01:00
parent 8b91b7ac8c
commit bd6a7c576f
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61

View File

@ -13,13 +13,18 @@ class CheckMetaMain(StandardBase):
def check(self, candidate, settings): def check(self, candidate, settings):
content, errors = self.get_raw_yaml(candidate, settings) content, errors = self.get_raw_yaml(candidate, settings)
keys = ["author", "description", "min_ansible_version", "platforms", "dependencies"] keys = ["author", "description", "min_ansible_version", "platforms"]
if not errors: if not errors:
has_galaxy_info = (isinstance(content, dict) and "galaxy_info" in content.keys()) has_galaxy_info = (isinstance(content, dict) and "galaxy_info" in content.keys())
has_dependencies = (isinstance(content, dict) and "dependencies" in content.keys())
if not has_galaxy_info: if not has_galaxy_info:
errors.append(self.Error(None, self.helptext.format(key="galaxy_info"))) errors.append(self.Error(None, self.helptext.format(key="galaxy_info")))
if not has_dependencies:
errors.append(self.Error(None, self.helptext.format(key="dependencies")))
for key in keys: for key in keys:
if has_galaxy_info and not nested_lookup(key, content.get("galaxy_info", {})): if has_galaxy_info and not nested_lookup(key, content.get("galaxy_info", {})):
errors.append(self.Error(None, self.helptext.format(key=key))) errors.append(self.Error(None, self.helptext.format(key=key)))