diff --git a/validations_libs/run.py b/validations_libs/run.py index fe2de85c..e7391f87 100644 --- a/validations_libs/run.py +++ b/validations_libs/run.py @@ -29,14 +29,21 @@ class Run(object): def __init__(self): self.log = logging.getLogger(__name__ + ".Run") - def run_validations(self, playbook, inventory, + def run_validations(self, playbook=[], inventory='localhost', group=None, extra_vars=None, validations_dir=None, - validation_name=None, extra_env_var=None, + validation_name=None, extra_env_vars=None, ansible_cfg=None, quiet=True): self.log = logging.getLogger(__name__ + ".run_validations") - playbooks = [] + if isinstance(playbook, list): + playbooks = playbook + elif isinstance(playbook, str): + playbooks = [] + playbooks.append(playbook) + else: + raise TypeError("Playbooks should be a List or a Str") + if group: self.log.debug('Getting the validations list by group') try: @@ -76,7 +83,7 @@ class Run(object): output_callback='validation_json', quiet=quiet, extra_vars=extra_vars, - extra_env_variables=extra_env_var, + extra_env_variables=extra_env_vars, ansible_cfg=ansible_cfg, gathering_policy='explicit') results.append({'validation': {