You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/06/23 20:32:23 UTC
git commit: Modify Rackspace UK compute driver so it works correctly
with the new auth system.
Updated Branches:
refs/heads/0.12.x 2a0479e16 -> f590c9fdb
Modify Rackspace UK compute driver so it works correctly with the new auth
system.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f590c9fd
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f590c9fd
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f590c9fd
Branch: refs/heads/0.12.x
Commit: f590c9fdb62ba4d952e45ef6cc898a45d2933bf4
Parents: 2a0479e
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Jun 23 20:31:19 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Jun 23 20:31:19 2013 +0200
----------------------------------------------------------------------
libcloud/compute/drivers/rackspace.py | 31 +++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/f590c9fd/libcloud/compute/drivers/rackspace.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/rackspace.py b/libcloud/compute/drivers/rackspace.py
index 203a73b..e3f4543 100644
--- a/libcloud/compute/drivers/rackspace.py
+++ b/libcloud/compute/drivers/rackspace.py
@@ -20,8 +20,7 @@ from libcloud.compute.base import NodeLocation
from libcloud.compute.drivers.openstack import OpenStack_1_0_Connection,\
OpenStack_1_0_NodeDriver, OpenStack_1_0_Response
-from libcloud.common.rackspace import (
- AUTH_URL_US, AUTH_URL_UK)
+from libcloud.common.rackspace import AUTH_URL_US, AUTH_URL_UK
class RackspaceConnection(OpenStack_1_0_Connection):
@@ -42,10 +41,12 @@ class RackspaceConnection(OpenStack_1_0_Connection):
elif ('1.1' in self._auth_version) or ('1.0' in self._auth_version):
ep = self.service_catalog.get_endpoint(name='cloudServers')
- if 'publicURL' in ep:
- return ep['publicURL']
+ public_url = ep.get('publicURL', None)
- raise LibcloudError('Could not find specified endpoint')
+ if not public_url:
+ raise LibcloudError('Could not find specified endpoint')
+
+ return public_url
class RackspaceNodeDriver(OpenStack_1_0_NodeDriver):
@@ -71,6 +72,24 @@ class RackspaceUKConnection(RackspaceConnection):
Connection class for the Rackspace UK driver
"""
auth_url = AUTH_URL_UK
+ _auth_version = '2.0'
+
+ def get_endpoint(self):
+ ep = self.service_catalog.get_endpoint(service_type='compute',
+ name='cloudServers')
+
+ public_url = ep.get('publicURL', None)
+
+ if not public_url:
+ raise LibcloudError('Could not find specified endpoint')
+
+ # Hack which is required because of how global auth works (old
+ # US accounts work with the lon endpoint, but don't have it in
+ # the service catalog)
+ public_url = public_url.replace('https://servers.api',
+ 'https://lon.servers.api')
+
+ return public_url
class RackspaceUKNodeDriver(RackspaceNodeDriver):
@@ -94,8 +113,6 @@ class RackspaceAUConnection(RackspaceConnection):
_auth_version = '2.0'
def get_endpoint(self):
- ep = {}
-
ep = self.service_catalog.get_endpoint(service_type='compute',
name='cloudServersOpenStack',
region='SYD')