Browse Source

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
Artur Svechnikov 3 years ago
parent
commit
e00d4bba51
2 changed files with 17 additions and 1 deletions
  1. 11
    0
      fuel_plugin_builder/tests/base.py
  2. 6
    1
      fuel_plugin_builder/validators/schemas/base.py

+ 11
- 0
fuel_plugin_builder/tests/base.py View File

@@ -184,6 +184,17 @@ class BaseValidator(BaseTestCase):
184 184
                 "of type 'string', value path 'attributes -> key1 -> type'"):
185 185
             self.validator.check_env_config_attrs()
186 186
 
187
+    def test_check_env_config_attrs_generator_value(self, utils_mock):
188
+        utils_mock.parse_yaml.return_value = {
189
+            'attributes': {
190
+                'key1': {
191
+                    'type': 'hidden',
192
+                    'label': '',
193
+                    'value': {'generator': 'password'},
194
+                    'weight': 1}}}
195
+
196
+        self.validator.check_env_config_attrs()
197
+
187 198
     def test_check_env_config_attrs_restriction_fails(self, utils_mock):
188 199
         utils_mock.parse_yaml.return_value = {
189 200
             'attributes': {

+ 6
- 1
fuel_plugin_builder/validators/schemas/base.py View File

@@ -169,7 +169,12 @@ class BaseSchema(object):
169 169
             'properties': {
170 170
                 'type': {'type': 'string'},
171 171
                 'weight': {'type': 'integer'},
172
-                'value': {'type': ['string', 'boolean']},
172
+                'value': {'anyOf': [
173
+                    {'type': 'string'},
174
+                    {'type': 'boolean'},
175
+                    {'type': 'object',
176
+                     'properties': {'generator': {'type': 'string'}}}
177
+                ]},
173 178
                 'label': {'type': 'string'},
174 179
                 'restrictions': self.restrictions,
175 180
                 'values': {'type': 'array', 'items':

Loading…
Cancel
Save