summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorricolin <rico.lin@easystack.cn>2018-08-06 00:50:58 +0800
committerricolin <rico.lin.guanyu@gmail.com>2020-01-22 10:58:13 +0800
commitb3a74dbf08c535dc5ae4d1aa7485dcbc3a6d4e8a (patch)
treea960d5e83812c9255a3650486b729553bb98cf1b
parente3de1453addee01a68e3b6eda29d683457a3df15 (diff)
downloadheat-b3a74dbf08c535dc5ae4d1aa7485dcbc3a6d4e8a.tar.gz
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
-rw-r--r--heat/engine/resources/openstack/heat/multi_part.py14
-rw-r--r--heat/tests/openstack/heat/test_multi_part.py14
-rw-r--r--releasenotes/notes/support_set_group_for_multipart-79b5819b9b3a82ad.yaml8
3 files changed, 30 insertions, 6 deletions
diff --git a/heat/engine/resources/openstack/heat/multi_part.py b/heat/engine/resources/openstack/heat/multi_part.py
index 6644721d9..e7b811739 100644
--- a/heat/engine/resources/openstack/heat/multi_part.py
+++ b/heat/engine/resources/openstack/heat/multi_part.py
@@ -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])
diff --git a/heat/tests/openstack/heat/test_multi_part.py b/heat/tests/openstack/heat/test_multi_part.py
index 85919dfc9..3d2b244c8 100644
--- a/heat/tests/openstack/heat/test_multi_part.py
+++ b/heat/tests/openstack/heat/test_multi_part.py
@@ -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()
diff --git a/releasenotes/notes/support_set_group_for_multipart-79b5819b9b3a82ad.yaml b/releasenotes/notes/support_set_group_for_multipart-79b5819b9b3a82ad.yaml
new file mode 100644
index 000000000..718bca212
--- /dev/null
+++ b/releasenotes/notes/support_set_group_for_multipart-79b5819b9b3a82ad.yaml
@@ -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``.