Processing available Ansible variables as 'parameters' not as 'metadata'
Before this patch, all the available Ansible variables for each validations coming from tripleo-validations were considered as 'metadata' which should only contain the following informations: ``` vars: metadata: name: ... description: ... groups: ... ``` This patch clarifies this by classifying all the potential variables as 'parameters' instead of 'metadata'. Change-Id: I7b65b73722ebe0462eb86265197b456e8c77ed13 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
parent
5692174259
commit
aa8132b736
@ -88,7 +88,7 @@ VALIDATION_GROUP_1_PARSED = {
|
||||
'description': 'A validation belonging to group1',
|
||||
'groups': ['group1'],
|
||||
'id': 'VALIDATION_GROUP_1',
|
||||
'metadata': {},
|
||||
'parameters': {},
|
||||
'name': 'First validation',
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ VALIDATION_WITH_METADATA_PARSED = {
|
||||
'description': 'A validation with extra metadata',
|
||||
'groups': [],
|
||||
'id': 'VALIDATION_WITH_METADATA',
|
||||
'metadata': {'foo': 'a foo metadata', 'bar': 42},
|
||||
'parameters': {'foo': 'a foo metadata', 'bar': 42},
|
||||
'name': 'Validation with metadata',
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ VALIDATION_GROUPS_1_2_PARSED = {
|
||||
'description': 'A validation belonging to groups 1 and 2',
|
||||
'groups': ['group1', 'group2'],
|
||||
'id': 'VALIDATION_GROUPS_1_2',
|
||||
'metadata': {},
|
||||
'parameters': {},
|
||||
'name': 'Validation from many groups',
|
||||
}
|
||||
|
||||
@ -146,18 +146,18 @@ class LoadValidationsTest(base.TestCase):
|
||||
value = validations.get_validation_metadata({}, 'missing')
|
||||
self.assertEqual('default_value', value)
|
||||
|
||||
def test_get_remaining_metadata(self):
|
||||
def test_get_validation_parameters(self):
|
||||
validation = yaml.safe_load(VALIDATION_WITH_METADATA)
|
||||
value = validations.get_remaining_metadata(validation)
|
||||
value = validations.get_validation_parameters(validation)
|
||||
expected = {
|
||||
'foo': 'a foo metadata',
|
||||
'bar': 42
|
||||
}
|
||||
self.assertEqual(expected, value)
|
||||
|
||||
def test_get_remaining_metadata_no_extra(self):
|
||||
def test_get_validation_parameters_no_extra(self):
|
||||
validation = yaml.safe_load(VALIDATION_GROUP_1)
|
||||
value = validations.get_remaining_metadata(validation)
|
||||
value = validations.get_validation_parameters(validation)
|
||||
self.assertEqual({}, value)
|
||||
|
||||
@mock.patch('tripleo_common.actions.base.TripleOAction.get_object_client')
|
||||
|
@ -66,7 +66,7 @@ def _get_validations_from_swift(swift, container, objects, groups, results,
|
||||
'groups': get_validation_metadata(validation, 'groups'),
|
||||
'description': get_validation_metadata(validation,
|
||||
'description'),
|
||||
'metadata': get_remaining_metadata(validation)
|
||||
'parameters': get_validation_parameters(validation)
|
||||
})
|
||||
|
||||
return results
|
||||
@ -103,7 +103,7 @@ def load_validations(swift, plan, groups=None):
|
||||
return results
|
||||
|
||||
|
||||
def get_remaining_metadata(validation):
|
||||
def get_validation_parameters(validation):
|
||||
try:
|
||||
return {
|
||||
k: v
|
||||
|
Loading…
Reference in New Issue
Block a user