libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1392565 - in /libcloud/trunk/libcloud: compute/drivers/rackspace.py test/compute/test_rackspace.py
Date Mon, 01 Oct 2012 20:18:54 GMT
Author: tomaz
Date: Mon Oct  1 20:18:54 2012
New Revision: 1392565

URL: http://svn.apache.org/viewvc?rev=1392565&view=rev
Log:
Update Rackspace compute drivers to only use 'datacenter' argument.

Modified:
    libcloud/trunk/libcloud/compute/drivers/rackspace.py
    libcloud/trunk/libcloud/test/compute/test_rackspace.py

Modified: libcloud/trunk/libcloud/compute/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/rackspace.py?rev=1392565&r1=1392564&r2=1392565&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/rackspace.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/rackspace.py Mon Oct  1 20:18:54 2012
@@ -27,24 +27,15 @@ from libcloud.common.rackspace import (
 
 
 ENDPOINT_ARGS_MAP = {
-    'us': {
-        'dfw':  {'service_type': 'compute',
-                  'name': 'cloudServersOpenStack',
-                  'region': 'DFW'},
-        'ord':  {'service_type': 'compute',
-                  'name': 'cloudServersOpenStack',
-                  'region': 'ORD'}
-    },
-    'uk': {
-        'default':  {'service_type': 'compute',
-                     'name': 'cloudServersOpenStack',
-                     'region': 'LON'}
-    },
-    'beta': {
-        'dfw':  {'service_type': 'compute',
-                 'name': 'cloudServersPreprod',
-                 'region': 'DFW'}
-    }
+    'dfw':  {'service_type': 'compute',
+              'name': 'cloudServersOpenStack',
+              'region': 'DFW'},
+    'ord':  {'service_type': 'compute',
+              'name': 'cloudServersOpenStack',
+              'region': 'ORD'},
+    'lon':  {'service_type': 'compute',
+             'name': 'cloudServersOpenStack',
+             'region': 'LON'}
 }
 
 
@@ -144,25 +135,20 @@ class RackspaceNodeDriver(OpenStack_1_1_
     api_name = None
 
     def __init__(self, key, secret=None, secure=True, host=None, port=None,
-                 region='us', datacenter='dfw', **kwargs):
-        if region not in ['us', 'uk']:
-            raise ValueError('Invalid region: %s' % (region))
+                 datacenter='dfw', **kwargs):
 
-        if region == 'us' and datacenter not in ['dfw', 'ord']:
+        if datacenter not in ['dfw', 'ord', 'lon']:
             raise ValueError('Invalid datacenter: %s' % (datacenter))
-        elif region in ['uk']:
-            datacenter = 'default'
 
-        if region == 'us':
+        if datacenter in ['dfw', 'ord']:
             self.connectionCls.auth_url = AUTH_URL_US
-        elif region == 'uk':
+        elif datacenter == 'lon':
             self.connectionCls.auth_url = AUTH_URL_UK
 
         self.connectionCls._auth_version = '2.0'
         self.connectionCls.get_endpoint_args = \
-                ENDPOINT_ARGS_MAP[region][datacenter]
+                ENDPOINT_ARGS_MAP[datacenter]
 
-        self.region = region
         self.datacenter = datacenter
 
         super(RackspaceNodeDriver, self).__init__(key=key, secret=secret,

Modified: libcloud/trunk/libcloud/test/compute/test_rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/test/compute/test_rackspace.py?rev=1392565&r1=1392564&r2=1392565&view=diff
==============================================================================
--- libcloud/trunk/libcloud/test/compute/test_rackspace.py (original)
+++ libcloud/trunk/libcloud/test/compute/test_rackspace.py Mon Oct  1 20:18:54 2012
@@ -95,43 +95,13 @@ class RackspaceNovaLonMockHttp(Rackspace
                 httplib.responses[httplib.OK])
 
 
-"""
-class RackspaceNovaBetaTests(OpenStack_1_1_Tests):
-
-    driver_klass = RackspaceNodeDriver
-    driver_type = RackspaceNodeDriver
-    driver_args = RACKSPACE_NOVA_PARAMS
-    driver_kwargs = {'region': 'beta', 'ex_force_auth_version': '2.0'}
-
-    @classmethod
-    def create_driver(self):
-        return self.driver_type(*self.driver_args, **self.driver_kwargs)
-
-    def setUp(self):
-        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaMockHttp,
-                                                        RackspaceNovaMockHttp)
-        self.driver_klass.connectionCls.auth_url = \
-                "https://auth.api.example.com/v2.0/"
-        self.driver = self.create_driver()
-        # normally authentication happens lazily, but we force it here
-        self.driver.connection._populate_hosts_and_request_paths()
-        clear_pricing_data()
-        self.node = self.driver.list_nodes()[1]
-
-    def test_service_catalog(self):
-        self.assertEqual(
-            'https://preprod.dfw.servers.api.rackspacecloud.com/v2/1337',
-            self.driver.connection.get_endpoint())
-"""
-
 
 class RackspaceNovaDfwTests(OpenStack_1_1_Tests):
 
     driver_klass = RackspaceNodeDriver
     driver_type = RackspaceNodeDriver
     driver_args = RACKSPACE_NOVA_PARAMS
-    driver_kwargs = {'region': 'us', 'datacenter': 'dfw',
-                     'ex_force_auth_version': '2.0'}
+    driver_kwargs = {'datacenter': 'dfw'}
 
     @classmethod
     def create_driver(self):
@@ -159,8 +129,7 @@ class RackspaceNovaOrdTests(OpenStack_1_
     driver_klass = RackspaceNodeDriver
     driver_type = RackspaceNodeDriver
     driver_args = RACKSPACE_NOVA_PARAMS
-    driver_kwargs = {'region': 'us', 'datacenter': 'ord',
-                     'ex_force_auth_version': '2.0'}
+    driver_kwargs = {'datacenter': 'ord'}
 
     @classmethod
     def create_driver(self):
@@ -187,8 +156,7 @@ class RackspaceNovaLonTests(OpenStack_1_
     driver_klass = RackspaceNodeDriver
     driver_type = RackspaceNodeDriver
     driver_args = RACKSPACE_NOVA_PARAMS
-    driver_kwargs = {'region': 'uk', 'datacenter': 'ord',
-                     'ex_force_auth_version': '2.0'}
+    driver_kwargs = {'datacenter': 'lon'}
 
     @classmethod
     def create_driver(self):



Mime
View raw message