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
This commit is contained in:
Andriy Popovych 2016-03-31 14:45:24 +03:00
parent 74f0e23118
commit a6f3a6a3fd
2 changed files with 22 additions and 1 deletions

View File

@ -549,6 +549,24 @@ class TestValidatorV3(BaseValidator):
utils_mock, mock_data, utils_mock, mock_data,
err_msg, self.validator.check_node_roles_schema) err_msg, self.validator.check_node_roles_schema)
@mock.patch('fuel_plugin_builder.validators.base.utils')
def test_check_node_role_conflicts(self, utils_mock):
utils_mock.parse_yaml.return_value = {
'plugin_name': {
'name': 'test_plugin',
'description': 'test plugin',
'conflicts': '*'}}
self.validator.check_node_roles_schema()
utils_mock.parse_yaml.return_value = {
'plugin_name': {
'name': 'test_plugin',
'description': 'test plugin',
'conflicts': ['some_role']}}
self.validator.check_node_roles_schema()
@mock.patch('fuel_plugin_builder.validators.base.utils') @mock.patch('fuel_plugin_builder.validators.base.utils')
def test_check_valid_volumes_roles_mapping_name(self, utils_mock): def test_check_valid_volumes_roles_mapping_name(self, utils_mock):
utils_mock.parse_yaml.return_value = { utils_mock.parse_yaml.return_value = {

View File

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