Add possiblity to use generator in environment config

It should be possible to use generators in
environment config. However validation schema
doesn't allow it.
Nailgun doesn't contain such scheme because
validation take place after all values have been
generated

Change-Id: Iff2feb7357afff02793deee65b6c65072914739c
Closes-Bug: #1557562
This commit is contained in:
Artur Svechnikov 2016-04-07 18:20:51 +03:00
parent 1810af3097
commit e00d4bba51
2 changed files with 17 additions and 1 deletions

View File

@ -184,6 +184,17 @@ class BaseValidator(BaseTestCase):
"of type 'string', value path 'attributes -> key1 -> type'"):
self.validator.check_env_config_attrs()
def test_check_env_config_attrs_generator_value(self, utils_mock):
utils_mock.parse_yaml.return_value = {
'attributes': {
'key1': {
'type': 'hidden',
'label': '',
'value': {'generator': 'password'},
'weight': 1}}}
self.validator.check_env_config_attrs()
def test_check_env_config_attrs_restriction_fails(self, utils_mock):
utils_mock.parse_yaml.return_value = {
'attributes': {

View File

@ -169,7 +169,12 @@ class BaseSchema(object):
'properties': {
'type': {'type': 'string'},
'weight': {'type': 'integer'},
'value': {'type': ['string', 'boolean']},
'value': {'anyOf': [
{'type': 'string'},
{'type': 'boolean'},
{'type': 'object',
'properties': {'generator': {'type': 'string'}}}
]},
'label': {'type': 'string'},
'restrictions': self.restrictions,
'values': {'type': 'array', 'items':