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
This commit is contained in:
Christopher Armstrong 2013-10-17 21:56:22 +00:00
parent 367829ed4e
commit 90e29eaf46
2 changed files with 12 additions and 3 deletions

View File

@ -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:

View File

@ -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"