Browse Source

Implement Validation Show Parameters

Change-Id: Ie3366f4f32dd87871315cc9f95f7c2335df25e4b
changes/56/713756/3
Mathieu Bultel 1 year ago
committed by Gael Chamoulaud
parent
commit
fd95a175b7
3 changed files with 26 additions and 3 deletions
  1. +13
    -0
      validations_libs/utils.py
  2. +4
    -3
      validations_libs/validation.py
  3. +9
    -0
      validations_libs/validation_actions.py

+ 13
- 0
validations_libs/utils.py View File

@ -165,3 +165,16 @@ def get_validations_stats(log):
"Failed: {}".format(total_number,
passed_number,
failed_number)}
def get_validations_parameters(validations_data, validation_name=[],
groups=[]):
params = {}
for val in validations_data['validations']:
v = Validation(val)
if v.id in validation_name or set(groups).intersection(v.groups):
params[v.id] = {
'parameters': (val.get('metadata') if val.get('metadata') else
val.get('parameters'))
}
return params

+ 4
- 3
validations_libs/validation.py View File

@ -35,8 +35,9 @@ class Validation(object):
@property
def get_metadata(self):
self.metadata = {'id': self.id}
self.metadata.update(self.dict['vars']['metadata'])
if self.dict['vars'].get('metadata'):
self.metadata = {'id': self.id}
self.metadata.update(self.dict['vars'].get('metadata'))
return self.metadata
@property
@ -52,7 +53,7 @@ class Validation(object):
@property
def groups(self):
return self.dict['vars']['metadata']['groups']
return self.dict['vars']['metadata'].get('groups')
@property
def get_id(self):


+ 9
- 0
validations_libs/validation_actions.py View File

@ -136,3 +136,12 @@ class ValidationActions(object):
group_info.append((gp[0], gp[1], len(validations)))
column_name = ("Groups", "Description", "Number of Validations")
return (column_name, group_info)
def show_validations_parameters(self, validation, group=None):
"""Return Validations Parameters"""
validations = v_utils.parse_all_validations_on_disk(
constants.ANSIBLE_VALIDATION_DIR)
return v_utils.get_validations_parameters({'validations': validations},
validation,
group)

Loading…
Cancel
Save