mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-22 21:00:44 +00:00
Robert Kaussow
43d7edca32
* refactor plugin system to use a class-based approach * disable some docstring linter errors and fix imports * cleanup * fix docs * add metavars to cli arguments for better helptext * add option to disable buildin rules * remove print * remove dead code
24 lines
743 B
Python
24 lines
743 B
Python
from nested_lookup import nested_lookup
|
|
|
|
from ansiblelater.standard import StandardBase
|
|
|
|
|
|
class CheckMetaMain(StandardBase):
|
|
|
|
sid = "ANSIBLE0002"
|
|
description = "Roles must contain suitable meta/main.yml"
|
|
helptext = "file should contain '{key}' key"
|
|
version = "0.1"
|
|
types = ["meta"]
|
|
|
|
def check(self, candidate, settings):
|
|
content, errors = self.get_raw_yaml(candidate, settings)
|
|
keys = ["author", "description", "min_ansible_version", "platforms", "dependencies"]
|
|
|
|
if not errors:
|
|
for key in keys:
|
|
if not nested_lookup(key, content):
|
|
errors.append(self.Error(None, self.helptext.format(key=key)))
|
|
|
|
return self.Result(candidate.path, errors)
|