mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-25 06:10:42 +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
684 B
Python
24 lines
684 B
Python
import os
|
|
|
|
from ansiblelater.standard import StandardBase
|
|
|
|
|
|
class CheckYamlFile(StandardBase):
|
|
|
|
sid = "LINT0006"
|
|
description = "Roles file should be in yaml format"
|
|
helptext = "file does not have a .yml extension"
|
|
version = "0.1"
|
|
types = ["playbook", "task", "handler"]
|
|
|
|
def check(self, candidate, settings):
|
|
errors = []
|
|
extensions = [".yml", ".yaml"]
|
|
|
|
if os.path.isfile(candidate.path) and os.path.splitext(candidate.path)[1] in extensions:
|
|
content, errors = self.get_raw_yaml(candidate, settings)
|
|
else:
|
|
errors.append(self.Error(None, self.helptext))
|
|
|
|
return self.Result(candidate.path, errors)
|