Add group property for OS::Heat::MultipartMime
Add ``group`` property to ``OS::Heat::MultipartMime``. This allow you to set group for entire multipart cofig resource like ``group`` property in ``OS::Heat::SoftwareConfig``. Aware that, you must make sure all configs in MultipartMime works with ``group``. Default value is ``Heat::Ungrouped``. Change-Id: I7e4d3a5e5631ae7bd0d5ebdac810ce04a4c98d4a Story: #2002683 Task: #22502
This commit is contained in:
parent
e3de1453ad
commit
b3a74dbf08
@ -45,9 +45,9 @@ class MultipartMime(software_config.SoftwareConfig):
|
||||
support_status = support.SupportStatus(version='2014.1')
|
||||
|
||||
PROPERTIES = (
|
||||
PARTS, CONFIG, FILENAME, TYPE, SUBTYPE
|
||||
PARTS, CONFIG, FILENAME, TYPE, SUBTYPE, GROUP
|
||||
) = (
|
||||
'parts', 'config', 'filename', 'type', 'subtype'
|
||||
'parts', 'config', 'filename', 'type', 'subtype', 'group'
|
||||
)
|
||||
|
||||
TYPES = (
|
||||
@ -57,6 +57,14 @@ class MultipartMime(software_config.SoftwareConfig):
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
GROUP: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
_('Namespace to group this multi-part configs by when delivered '
|
||||
'to a server. This may imply what configuration tool is going '
|
||||
'to perform the configuration.'),
|
||||
support_status=support.SupportStatus(version='14.0.0'),
|
||||
default='Heat::Ungrouped'
|
||||
),
|
||||
PARTS: properties.Schema(
|
||||
properties.Schema.LIST,
|
||||
_('Parts belonging to this message.'),
|
||||
@ -96,7 +104,7 @@ class MultipartMime(software_config.SoftwareConfig):
|
||||
props = {
|
||||
rpc_api.SOFTWARE_CONFIG_NAME: self.physical_resource_name(),
|
||||
rpc_api.SOFTWARE_CONFIG_CONFIG: self.get_message(),
|
||||
rpc_api.SOFTWARE_CONFIG_GROUP: 'Heat::Ungrouped'
|
||||
rpc_api.SOFTWARE_CONFIG_GROUP: self.properties[self.GROUP]
|
||||
}
|
||||
sc = self.rpc_client().create_software_config(self.context, **props)
|
||||
self.resource_id_set(sc[rpc_api.SOFTWARE_CONFIG_ID])
|
||||
|
@ -31,7 +31,7 @@ class MultipartMimeTest(common.HeatTestCase):
|
||||
self.ctx = utils.dummy_context()
|
||||
self.init_config()
|
||||
|
||||
def init_config(self, parts=None):
|
||||
def init_config(self, parts=None, group='Heat::Ungrouped'):
|
||||
parts = parts or []
|
||||
stack = parser.Stack(
|
||||
self.ctx, 'software_config_test_stack',
|
||||
@ -41,13 +41,15 @@ class MultipartMimeTest(common.HeatTestCase):
|
||||
'config_mysql': {
|
||||
'Type': 'OS::Heat::MultipartMime',
|
||||
'Properties': {
|
||||
'group': group,
|
||||
'parts': parts
|
||||
}}}}))
|
||||
self.config = stack['config_mysql']
|
||||
self.rpc_client = mock.MagicMock()
|
||||
self.config._rpc_client = self.rpc_client
|
||||
|
||||
def test_handle_create(self):
|
||||
def _test_create(self, group='Heat::Ungrouped'):
|
||||
self.init_config(group=group)
|
||||
config_id = 'c8a19429-7fde-47ea-a42f-40045488226c'
|
||||
sc = {'id': config_id}
|
||||
self.rpc_client.create_software_config.return_value = sc
|
||||
@ -59,9 +61,15 @@ class MultipartMimeTest(common.HeatTestCase):
|
||||
self.assertEqual({
|
||||
'name': self.config.physical_resource_name(),
|
||||
'config': self.config.message,
|
||||
'group': 'Heat::Ungrouped'
|
||||
'group': group
|
||||
}, kwargs)
|
||||
|
||||
def test_handle_create(self):
|
||||
self._test_create()
|
||||
|
||||
def test_handle_create_with_group(self):
|
||||
self._test_create(group='script')
|
||||
|
||||
def test_get_message_not_none(self):
|
||||
self.config.message = 'Not none'
|
||||
result = self.config.get_message()
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add ``group`` property to ``OS::Heat::MultipartMime``. This allow you to
|
||||
set group for entire multipart cofig resource like ``group`` property in
|
||||
``OS::Heat::SoftwareConfig``. Aware that, you must make sure all configs
|
||||
in MultipartMime works with ``group``. Default value is
|
||||
``Heat::Ungrouped``.
|
Loading…
Reference in New Issue
Block a user