diff options
Diffstat (limited to 'heat')
-rw-r--r-- | heat/engine/resources/openstack/nova/server_group.py | 10 | ||||
-rw-r--r-- | heat/tests/openstack/nova/test_server_group.py | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/heat/engine/resources/openstack/nova/server_group.py b/heat/engine/resources/openstack/nova/server_group.py index 90a6ff171..b4eb95662 100644 --- a/heat/engine/resources/openstack/nova/server_group.py +++ b/heat/engine/resources/openstack/nova/server_group.py @@ -96,8 +96,14 @@ class ServerGroup(resource.Resource): name = self.physical_resource_name() policies = self.properties[self.POLICIES] rules = self.properties[self.RULES] - server_group = self.client().server_groups.create( - name=name, policy=policies[0], rules=rules) + rules_supported = self.client_plugin().is_version_supported( + MICROVERSION_RULE) + if rules_supported: + server_group = self.client().server_groups.create( + name=name, policy=policies[0], rules=rules) + else: + server_group = self.client().server_groups.create( + name=name, policies=policies) self.resource_id_set(server_group.id) def physical_resource_name(self): diff --git a/heat/tests/openstack/nova/test_server_group.py b/heat/tests/openstack/nova/test_server_group.py index 4059e37c2..c2dfda484 100644 --- a/heat/tests/openstack/nova/test_server_group.py +++ b/heat/tests/openstack/nova/test_server_group.py @@ -52,6 +52,12 @@ class NovaServerGroupTest(common.HeatTestCase): # create mock clients and objects nova = mock.MagicMock() self.sg.client = mock.MagicMock(return_value=nova) + mock_plugin = mock.MagicMock() + self.patchobject(mock_plugin, + 'is_version_supported', + return_value=True) + self.patchobject(self.sg, 'client_plugin', + return_value=mock_plugin) self.sg_mgr = nova.server_groups def _create_sg(self, name): |