From f55140b2e6300caace45e945354f80abcddf4568 Mon Sep 17 00:00:00 2001 From: Christos Psaltis Date: Wed, 13 Mar 2013 19:29:06 +0200 Subject: [PATCH] Implement list_locations() in new Rackspace provider --- libcloud/compute/drivers/rackspace.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git libcloud/compute/drivers/rackspace.py libcloud/compute/drivers/rackspace.py index af05e0c..d00b562 100644 --- libcloud/compute/drivers/rackspace.py +++ libcloud/compute/drivers/rackspace.py @@ -170,3 +170,21 @@ class RackspaceNodeDriver(OpenStack_1_1_NodeDriver): super(RackspaceNodeDriver, self).__init__(key=key, secret=secret, secure=secure, host=host, port=port, **kwargs) + + def list_locations(self): + """ + Lists available locations + + Locations cannot be set or retrieved via the API, but currently + there are three locations, DFW, ORD and LON. + + @inherits: L{OpenStack_1_1_NodeDriver.list_locations} + """ + if self.datacenter == 'dfw': + locations = [NodeLocation(0, 'Rackspace Dallas', 'US', self)] + elif self.datacenter == 'ord': + locations = [NodeLocation(0, 'Rackspace Chicago', 'US', self)] + elif self.datacenter == 'lon': + locations = [NodeLocation(0, 'Rackspace London', 'UK', self)] + + return locations -- 1.7.12.4 (Apple Git-37)