Browse Source

Remove playbook param from run_validation

Removing playbook parameters from run_validation function
since its overlap validation_name functionality and make it
confusing.

Change-Id: Ifff9bdb327b38db07df6cac328cbd387f2bc46f1
(cherry picked from commit de03576eeb)
changes/40/738840/1
Mathieu Bultel 1 year ago
committed by mathieu bultel
parent
commit
e0bf69783f
  1. 4
      validations_libs/tests/test_validation_actions.py
  2. 16
      validations_libs/validation_actions.py

4
validations_libs/tests/test_validation_actions.py

@ -129,7 +129,9 @@ class TestValidationActions(TestCase):
validations_dir='/tmp/foo')
self.assertEqual(run_return, expected_run_return)
def test_validation_run_no_validation(self):
@mock.patch('validations_libs.utils.get_validations_playbook',
return_value=[])
def test_validation_run_no_validation(self, mock_get_val):
playbook = ['fake.yaml']
inventory = 'tmp/inventory.yaml'

16
validations_libs/validation_actions.py

@ -58,25 +58,15 @@ class ValidationActions(object):
data.update(format)
return data
def run_validations(self, playbook=[], inventory='localhost',
def run_validations(self, validation_name=None, inventory='localhost',
group=None, extra_vars=None, validations_dir=None,
validation_name=None, extra_env_vars=None,
ansible_cfg=None, quiet=True, workdir=None,
limit_hosts=None, run_async=False,
extra_env_vars=None, ansible_cfg=None, quiet=True,
workdir=None, limit_hosts=None, run_async=False,
base_dir=constants.DEFAULT_VALIDATIONS_BASEDIR):
self.log = logging.getLogger(__name__ + ".run_validations")
playbooks = []
validations_dir = (validations_dir if validations_dir
else self.validation_path)
if playbook:
if isinstance(playbook, list):
playbooks = playbook
elif isinstance(playbook, str):
playbooks = [playbook]
else:
raise TypeError("Playbooks should be a List or a Str")
if group:
self.log.debug('Getting the validations list by group')
try:

Loading…
Cancel
Save