Add 'group' field to the sample plugin v4
Also add validation for values of this field Implements: blueprint segment-settings-tab-logically Change-Id: I06e584621d75634d5896928395b71e4a4e180328
This commit is contained in:
parent
2cbe7a136a
commit
f877ebd56a
|
@ -6,6 +6,8 @@ New package version "4.0.0" includes the following features:
|
|||
|
||||
- New flag `is_hotpluggable` in `metadata.yaml` that allows to install and use
|
||||
plugin on previously deployed environments.
|
||||
- Plugin can specify settings group using "group" field in metadata in
|
||||
environment_config.yaml file.
|
||||
|
||||
## 3.0.0 (2014-09-16)
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
attributes:
|
||||
metadata:
|
||||
group: 'other'
|
||||
fuel_plugin_example_v4_text:
|
||||
value: 'Set default value'
|
||||
label: 'Text field'
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
attributes:
|
||||
metadata:
|
||||
# Settings group can be one of "general", "security", "compute", "network",
|
||||
# "storage", "logging", "openstack_services" and "other".
|
||||
group: 'other'
|
||||
${plugin_name}_text:
|
||||
value: 'Set default value'
|
||||
label: 'Text field'
|
||||
description: 'Description for text field'
|
||||
weight: 25
|
||||
type: "text"
|
|
@ -107,6 +107,27 @@ class TestValidatorV4(TestValidatorV3):
|
|||
utils_mock.parse_yaml.return_value = mock_data
|
||||
self.assertEqual(None, self.validator.check_metadata_schema())
|
||||
|
||||
@mock.patch('fuel_plugin_builder.validators.base.utils')
|
||||
def test_environment_config_settings_groups(self, utils_mock):
|
||||
mock_data = {'attributes': {}}
|
||||
utils_mock.parse_yaml.return_value = mock_data
|
||||
self.assertEqual(None, self.validator.check_env_config_attrs())
|
||||
|
||||
mock_data = {'attributes': {'metadata': {}}}
|
||||
utils_mock.parse_yaml.return_value = mock_data
|
||||
self.assertEqual(None, self.validator.check_env_config_attrs())
|
||||
|
||||
mock_data = {'attributes': {'metadata': {'group': 'network'}}}
|
||||
utils_mock.parse_yaml.return_value = mock_data
|
||||
self.assertEqual(None, self.validator.check_env_config_attrs())
|
||||
|
||||
mock_data = {'attributes': {'metadata': {'group': 'unknown'}}}
|
||||
utils_mock.parse_yaml.return_value = mock_data
|
||||
self.assertRaises(
|
||||
errors.ValidationError,
|
||||
self.validator.check_env_config_attrs
|
||||
)
|
||||
|
||||
def test_check_components_schema_validation_failed(self):
|
||||
data_sets = [
|
||||
{
|
||||
|
|
|
@ -38,6 +38,26 @@ class SchemaV4(SchemaV3):
|
|||
schema['properties']['is_hotpluggable'] = {'type': 'boolean'}
|
||||
return schema
|
||||
|
||||
@property
|
||||
def attr_root_schema(self):
|
||||
schema = super(SchemaV4, self).attr_root_schema
|
||||
schema['properties']['attributes']['properties'] = {
|
||||
'metadata': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'group': {
|
||||
'enum': [
|
||||
'general', 'security',
|
||||
'compute', 'network',
|
||||
'storage', 'logging',
|
||||
'openstack_services', 'other'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return schema
|
||||
|
||||
@property
|
||||
def components_items(self):
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue