From 90e29eaf46dd90895a4f35da6e0d9e772290a0e3 Mon Sep 17 00:00:00 2001 From: Christopher Armstrong Date: Thu, 17 Oct 2013 21:56:22 +0000 Subject: [PATCH] RS LoadBalancer should return its ID as Ref Previously the Rackspace::Cloud::LoadBalancer resource returned the name as its reference ID. This patch reverts this to the default resource behavior of returning the resource ID if available, and then falling back to the name. Otherwise there is no way to access the ID of the load balancer, which is necessary for other Rackspace APIs, such as Rackspace Auto Scale. Closes-Bug: #1241194 Change-Id: Ib5ca296b338e912daa8c3dc1c71fc3e994a0156e --- .../heat/engine/plugins/cloud_loadbalancer.py | 3 --- .../rackspace/heat/tests/test_cloud_loadbalancer.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/rackspace/heat/engine/plugins/cloud_loadbalancer.py b/contrib/rackspace/heat/engine/plugins/cloud_loadbalancer.py index c66ff99e02..538df497d0 100644 --- a/contrib/rackspace/heat/engine/plugins/cloud_loadbalancer.py +++ b/contrib/rackspace/heat/engine/plugins/cloud_loadbalancer.py @@ -431,9 +431,6 @@ class CloudLoadBalancer(rackspace_resource.RackspaceResource): except exception.StackValidationFailed as svf: return {'Error': str(svf)} - def FnGetRefId(self): - return unicode(self.name) - def _public_ip(self): #TODO(andrew-plunk) return list here and let caller choose ip for ip in self.clb.get(self.resource_id).virtual_ips: diff --git a/contrib/rackspace/heat/tests/test_cloud_loadbalancer.py b/contrib/rackspace/heat/tests/test_cloud_loadbalancer.py index aed5875cb9..d0772a692f 100644 --- a/contrib/rackspace/heat/tests/test_cloud_loadbalancer.py +++ b/contrib/rackspace/heat/tests/test_cloud_loadbalancer.py @@ -401,6 +401,18 @@ class LoadBalancerTest(HeatTestCase): scheduler.TaskRunner(rsrc.create)() self.m.VerifyAll() + def test_ref_id(self): + """The Reference ID of the resource is the resource ID.""" + template = self._set_template(self.lb_template) + rsrc, fake_loadbalancer = self._mock_loadbalancer(template, + self.lb_name, + self.expected_body) + self.m.ReplayAll() + scheduler.TaskRunner(rsrc.create)() + self.m.VerifyAll() + + self.assertEqual(rsrc.FnGetRefId(), rsrc.resource_id) + def test_post_creation_error_page(self): error_page = "REALLY BIG ERROR"