From: Jeff Peeler Date: Mon, 20 May 2013 20:14:57 +0000 (-0400) Subject: Use UUIDs for Quantum security groups X-Git-Tag: 2014.1~561 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=32c21dccc017c3c451eea468dda6fb9a889a7070;p=openstack-build%2Fheat-build.git Use UUIDs for Quantum security groups Quantum security groups are referenced by ID and supports duplicate names, so having the ID available helps to avoid searching for it when needed. Change-Id: Idff9245b9848083029dd47fb2253a64b0c5de523 --- diff --git a/heat/engine/resources/security_group.py b/heat/engine/resources/security_group.py index 24089784..3478e9b8 100644 --- a/heat/engine/resources/security_group.py +++ b/heat/engine/resources/security_group.py @@ -179,7 +179,10 @@ class SecurityGroup(resource.Resource): self.resource_id = None def FnGetRefId(self): - return self.physical_resource_name() + if self.properties['VpcId']: + return super(SecurityGroup, self).FnGetRefId() + else: + return self.physical_resource_name() def resource_mapping(): diff --git a/heat/tests/test_security_group.py b/heat/tests/test_security_group.py index 5be744df..20582023 100644 --- a/heat/tests/test_security_group.py +++ b/heat/tests/test_security_group.py @@ -412,7 +412,7 @@ Resources: sg = stack['the_sg'] self.assertRaises(resource.UpdateReplace, sg.handle_update, {}, {}, {}) - self.assertResourceState(sg, 'test_stack.the_sg') + self.assertResourceState(sg, 'aaaa') stack.delete() self.m.VerifyAll() @@ -528,7 +528,7 @@ Resources: sg = stack['the_sg'] self.assertRaises(resource.UpdateReplace, sg.handle_update, {}, {}, {}) - self.assertResourceState(sg, 'test_stack.the_sg') + self.assertResourceState(sg, 'aaaa') self.assertEqual(None, sg.delete())