Browse Source

Add ability for role to conflict with all roles

To support conflict of some node role with other roles '*' symbol is used.
This patch provides fix in validation for such situation.

Change-Id: If0123dbb05df0eddb071527990417ebafe300c93
Related Bug: #1547590
Andriy Popovych 3 years ago
parent
commit
a6f3a6a3fd

+ 18
- 0
fuel_plugin_builder/tests/test_validator_v3.py View File

@@ -549,6 +549,24 @@ class TestValidatorV3(BaseValidator):
549 549
             utils_mock, mock_data,
550 550
             err_msg, self.validator.check_node_roles_schema)
551 551
 
552
+    @mock.patch('fuel_plugin_builder.validators.base.utils')
553
+    def test_check_node_role_conflicts(self, utils_mock):
554
+        utils_mock.parse_yaml.return_value = {
555
+            'plugin_name': {
556
+                'name': 'test_plugin',
557
+                'description': 'test plugin',
558
+                'conflicts': '*'}}
559
+
560
+        self.validator.check_node_roles_schema()
561
+
562
+        utils_mock.parse_yaml.return_value = {
563
+            'plugin_name': {
564
+                'name': 'test_plugin',
565
+                'description': 'test plugin',
566
+                'conflicts': ['some_role']}}
567
+
568
+        self.validator.check_node_roles_schema()
569
+
552 570
     @mock.patch('fuel_plugin_builder.validators.base.utils')
553 571
     def test_check_valid_volumes_roles_mapping_name(self, utils_mock):
554 572
         utils_mock.parse_yaml.return_value = {

+ 4
- 1
fuel_plugin_builder/validators/schemas/v3.py View File

@@ -326,7 +326,10 @@ class SchemaV3(SchemaV2):
326 326
                             'type': 'string',
327 327
                             'description': ('Short description of role'
328 328
                                             ' functionality')},
329
-                        'conflicts': self.list_of_strings,
329
+                        'conflicts': {
330
+                            'oneOf': [
331
+                                self.list_of_strings,
332
+                                {'type': 'string', 'enum': ['*']}]},
330 333
                         'has_primary': {
331 334
                             'type': 'boolean',
332 335
                             'description': ('During orchestration this role'

Loading…
Cancel
Save