Merge pull request #7 from matbu/master
Handle List or string playbook type
This commit is contained in:
commit
06892d8c65
@ -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")
|
||||
|
||||
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': {
|
||||
|
Loading…
Reference in New Issue
Block a user