Browse Source

Add parameters values to the validation show command

The parameters was missing to the validation show output.

Change-Id: I1d2ebeb3fbe8a1438e8acec77d3a15b2816f786f
changes/60/757960/2
Mathieu Bultel 7 months ago
parent
commit
cba2ce087d
3 changed files with 9 additions and 3 deletions
  1. +2
    -1
      validations_libs/tests/test_utils.py
  2. +2
    -1
      validations_libs/tests/test_validation_actions.py
  3. +5
    -1
      validations_libs/utils.py

+ 2
- 1
validations_libs/tests/test_utils.py View File

@ -37,7 +37,8 @@ class TestUtils(TestCase):
def test_get_validations_data(self, mock_exists, mock_open, mock_data):
output = {'Name': 'Advanced Format 512e Support',
'Description': 'foo', 'Groups': ['prep', 'pre-deployment'],
'ID': '512e'}
'ID': '512e',
'Parameters': {}}
res = utils.get_validations_data('512e')
self.assertEqual(res, output)


+ 2
- 1
validations_libs/tests/test_validation_actions.py View File

@ -152,7 +152,8 @@ class TestValidationActions(TestCase):
mock_parse_validation, mock_data, mock_log):
data = {'Name': 'Advanced Format 512e Support',
'Description': 'foo', 'Groups': ['prep', 'pre-deployment'],
'ID': '512e'}
'ID': '512e',
'Parameters': {}}
data.update({'Last execution date': '2019-11-25 13:40:14',
'Number of execution': 'Total: 1, Passed: 0, Failed: 1'})
validations_show = ValidationActions()


+ 5
- 1
validations_libs/utils.py View File

@ -117,9 +117,13 @@ def get_validations_data(validation, path=constants.ANSIBLE_VALIDATION_DIR):
Return validations data with format:
ID, Name, Description, Groups, Other param
"""
data = {}
val_path = "{}/{}.yaml".format(path, validation)
if os.path.exists(val_path):
return Validation(val_path).get_formated_data
val = Validation(val_path)
data.update(val.get_formated_data)
data.update({'Parameters': val.get_vars})
return data
def get_validations_parameters(validations_data, validation_name=[],


Loading…
Cancel
Save