From 32c21dccc017c3c451eea468dda6fb9a889a7070 Mon Sep 17 00:00:00 2001 From: Jeff Peeler Date: Mon, 20 May 2013 16:14:57 -0400 Subject: [PATCH] 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 --- heat/engine/resources/security_group.py | 5 ++++- heat/tests/test_security_group.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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()) -- 2.45.2