diff options
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``. |