Add parameters values to the validation show command

The parameters was missing to the validation show output.

Change-Id: I1d2ebeb3fbe8a1438e8acec77d3a15b2816f786f
This commit is contained in:
Mathieu Bultel 2020-10-13 23:58:20 +02:00
parent 22a90ed09c
commit cba2ce087d
3 changed files with 9 additions and 3 deletions

View File

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

View File

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

View File

@ -117,9 +117,13 @@ def get_validations_data(validation, path=constants.ANSIBLE_VALIDATION_DIR):
Return validations data with format: Return validations data with format:
ID, Name, Description, Groups, Other param ID, Name, Description, Groups, Other param
""" """
data = {}
val_path = "{}/{}.yaml".format(path, validation) val_path = "{}/{}.yaml".format(path, validation)
if os.path.exists(val_path): 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=[], def get_validations_parameters(validations_data, validation_name=[],