libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [05/15] libcloud git commit: Remove deprecated, per region classes for Rackspace loadbalancer driver.
Date Wed, 06 Apr 2016 15:17:37 GMT
Remove deprecated, per region classes for Rackspace loadbalancer driver.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b6ff8db8
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b6ff8db8
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b6ff8db8

Branch: refs/heads/trunk
Commit: b6ff8db874f9ee8d0b97de155d5d0cad60b10bde
Parents: 41b9caa
Author: Tomaz Muraus <tomaz@tomaz.me>
Authored: Wed Mar 16 16:50:11 2016 -0700
Committer: Tomaz Muraus <tomaz@tomaz.me>
Committed: Thu Mar 31 18:32:19 2016 -0700

----------------------------------------------------------------------
 libcloud/loadbalancer/drivers/rackspace.py   |  6 ------
 libcloud/loadbalancer/providers.py           | 11 ++++-------
 libcloud/loadbalancer/types.py               |  8 ++++++++
 libcloud/test/loadbalancer/test_rackspace.py |  3 +--
 4 files changed, 13 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b6ff8db8/libcloud/loadbalancer/drivers/rackspace.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/rackspace.py b/libcloud/loadbalancer/drivers/rackspace.py
index ed112e2..898c0bc 100644
--- a/libcloud/loadbalancer/drivers/rackspace.py
+++ b/libcloud/loadbalancer/drivers/rackspace.py
@@ -1525,9 +1525,3 @@ class RackspaceLBDriver(Driver, OpenStackDriverMixin):
                 break
 
         return date
-
-
-class RackspaceUKLBDriver(RackspaceLBDriver):
-    def __init__(self, *args, **kwargs):
-        kwargs['region'] = 'lon'
-        super(RackspaceUKLBDriver, self).__init__(*args, **kwargs)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b6ff8db8/libcloud/loadbalancer/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/providers.py b/libcloud/loadbalancer/providers.py
index ef0f26b..49a0f3a 100644
--- a/libcloud/loadbalancer/providers.py
+++ b/libcloud/loadbalancer/providers.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 from libcloud.loadbalancer.types import Provider
+from libcloud.loadbalancer.types import OLD_CONSTANT_TO_NEW_MAPPING
 from libcloud.common.providers import get_driver as _get_provider_driver
 from libcloud.common.providers import set_driver as _set_provider_driver
 
@@ -44,17 +45,13 @@ DRIVERS = {
     ('libcloud.loadbalancer.drivers.dimensiondata', 'DimensionDataLBDriver'),
     Provider.ALIYUN_SLB:
     ('libcloud.loadbalancer.drivers.slb', 'SLBDriver'),
-
-    # Deprecated
-    Provider.RACKSPACE_US:
-    ('libcloud.loadbalancer.drivers.rackspace', 'RackspaceLBDriver'),
-    Provider.RACKSPACE_UK:
-    ('libcloud.loadbalancer.drivers.rackspace', 'RackspaceUKLBDriver'),
 }
 
 
 def get_driver(provider):
-    return _get_provider_driver(drivers=DRIVERS, provider=provider)
+    deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
+    return _get_provider_driver(drivers=DRIVERS, provider=provider,
+                                deprecated_constants=deprecated_constants)
 
 
 def set_driver(provider, module, klass):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b6ff8db8/libcloud/loadbalancer/types.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/types.py b/libcloud/loadbalancer/types.py
index cfb010b..b0fba05 100644
--- a/libcloud/loadbalancer/types.py
+++ b/libcloud/loadbalancer/types.py
@@ -18,6 +18,8 @@ __all__ = [
     "State",
     "LibcloudLBError",
     "LibcloudLBImmutableError",
+
+    "OLD_CONSTANT_TO_NEW_MAPPING"
 ]
 
 from libcloud.common.types import LibcloudError
@@ -51,6 +53,12 @@ class Provider(object):
     RACKSPACE_UK = 'rackspace_uk'
 
 
+OLD_CONSTANT_TO_NEW_MAPPING = {
+    Provider.RACKSPACE_US: Provider.RACKSPACE,
+    Provider.RACKSPACE_UK: Provider.RACKSPACE,
+}
+
+
 class State(object):
     """
     Standard states for a loadbalancer

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b6ff8db8/libcloud/test/loadbalancer/test_rackspace.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_rackspace.py b/libcloud/test/loadbalancer/test_rackspace.py
index 9b78395..15ba54c 100644
--- a/libcloud/test/loadbalancer/test_rackspace.py
+++ b/libcloud/test/loadbalancer/test_rackspace.py
@@ -29,7 +29,6 @@ from libcloud.loadbalancer.types import MemberCondition
 from libcloud.loadbalancer.drivers.rackspace import RackspaceLBDriver, \
     RackspaceHealthMonitor, RackspaceHTTPHealthMonitor, \
     RackspaceConnectionThrottle, RackspaceAccessRule
-from libcloud.loadbalancer.drivers.rackspace import RackspaceUKLBDriver
 from libcloud.loadbalancer.drivers.rackspace import RackspaceAccessRuleType
 from libcloud.common.types import LibcloudError
 
@@ -922,7 +921,7 @@ class RackspaceUKLBTests(RackspaceLBTests):
         RackspaceLBDriver.connectionCls.conn_classes = (None,
                                                         RackspaceLBMockHttp)
         RackspaceLBMockHttp.type = None
-        self.driver = RackspaceUKLBDriver('user', 'key')
+        self.driver = RackspaceLBDriver('user', 'key', region='lon')
         # normally authentication happens lazily, but we force it here
         self.driver.connection._populate_hosts_and_request_paths()
 


Mime
View raw message