From a83dca22dfbabb7124ddad2bd81f6795785f7712 Mon Sep 17 00:00:00 2001 From: tengqm Date: Fri, 30 Jan 2015 21:25:58 +0800 Subject: [PATCH] Fix sw component creation parameter error The switching to rpc calls for software component is broken due to stricter keyword argument checking. An additional 'configs' parameter is rejected by rpc client. This patch removes 'configs' from the keyword arguments and adds a test case that the rpc method is invoked with expected parameters. Change-Id: I8b1674dbea2b9f0fe92a3fab946ce83cd64521ad Closes-Bug: 1416404 --- .../resources/software_config/software_component.py | 1 + heat/tests/test_software_component.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/heat/engine/resources/software_config/software_component.py b/heat/engine/resources/software_config/software_component.py index 7725fd24b7..36bcad6f85 100644 --- a/heat/engine/resources/software_config/software_component.py +++ b/heat/engine/resources/software_config/software_component.py @@ -116,6 +116,7 @@ class SoftwareComponent(sc.SoftwareConfig): props[self.CONFIG] = {self.CONFIGS: configs} # set 'group' to enable component processing by in-instance hook props[self.GROUP] = 'component' + del props['configs'] 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/test_software_component.py b/heat/tests/test_software_component.py index e48a4990b6..42fd882c51 100644 --- a/heat/tests/test_software_component.py +++ b/heat/tests/test_software_component.py @@ -71,7 +71,16 @@ class SoftwareComponentTest(common.HeatTestCase): config_id = 'c8a19429-7fde-47ea-a42f-40045488226c' value = {'id': config_id} self.rpc_client.create_software_config.return_value = value + props = dict(self.component.properties) self.component.handle_create() + self.rpc_client.create_software_config.assert_called_with( + self.ctx, + group='component', + name=None, + inputs=props['inputs'], + outputs=props['outputs'], + config={'configs': props['configs']}, + options=None) self.assertEqual(config_id, self.component.resource_id) def test_handle_delete(self):