libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [03/15] libcloud git commit: Drop support for provider constants with region in the name.
Date Wed, 06 Apr 2016 15:17:35 GMT
Drop support for provider constants with region in the name.

Also remove related and deprecated old class names.


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

Branch: refs/heads/trunk
Commit: a7337fedcd02f5ab68f017e245c2d60f5d6398e5
Parents: 705206a
Author: Tomaz Muraus <tomaz@tomaz.me>
Authored: Tue Mar 15 14:44:52 2016 -0700
Committer: Tomaz Muraus <tomaz@tomaz.me>
Committed: Thu Mar 31 18:32:19 2016 -0700

----------------------------------------------------------------------
 CHANGES.rst                             |  7 +++
 libcloud/compute/drivers/ec2.py         | 67 ----------------------------
 libcloud/compute/providers.py           | 49 ++++----------------
 libcloud/compute/types.py               | 43 +++++++++++++-----
 libcloud/storage/drivers/cloudfiles.py  | 26 -----------
 libcloud/test/compute/test_ec2.py       | 48 --------------------
 libcloud/test/compute/test_rackspace.py |  8 +++-
 7 files changed, 55 insertions(+), 193 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a7337fed/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 0414d88..6b3048f 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -107,6 +107,13 @@ Compute
   (LIBCLOUD-802, GITHUB-712)
   [Sam Song]
 
+* Remove deprecated provider constants with the region in the name and related
+  driver classes (e.g. `EC2_US_EAST``, etc.).
+
+  Those drivers have moved to single provider constant + ``region`` constructor
+  argument model.
+  [Tomaz Muraus]
+
 Storage
 ~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a7337fed/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 07637c8..9ac4793 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -6348,73 +6348,6 @@ class IdempotentParamError(LibcloudError):
         return repr(self.value)
 
 
-class EC2EUNodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the Western Europe Region.
-    """
-    name = 'Amazon EC2 (eu-west-1)'
-    _region = 'eu-west-1'
-
-
-class EC2USWestNodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the Western US Region
-    """
-    name = 'Amazon EC2 (us-west-1)'
-    _region = 'us-west-1'
-
-
-class EC2USWestOregonNodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the US West Oregon region.
-    """
-    name = 'Amazon EC2 (us-west-2)'
-    _region = 'us-west-2'
-
-
-class EC2APSENodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the Southeast Asia Pacific Region.
-    """
-    name = 'Amazon EC2 (ap-southeast-1)'
-    _region = 'ap-southeast-1'
-
-
-class EC2APNE1NodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the Northeast Asia Pacific 1(Tokyo) Region.
-    """
-    name = 'Amazon EC2 (ap-northeast-1)'
-    _region = 'ap-northeast-1'
-
-
-EC2APNENodeDriver = EC2APNE1NodeDriver  # fallback
-
-
-class EC2APNE2NodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the Northeast Asia Pacific 2(Seoul) Region.
-    """
-    name = 'Amazon EC2 (ap-northeast-2)'
-    _region = 'ap-northeast-2'
-
-
-class EC2SAEastNodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the South America (Sao Paulo) Region.
-    """
-    name = 'Amazon EC2 (sa-east-1)'
-    _region = 'sa-east-1'
-
-
-class EC2APSESydneyNodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the Southeast Asia Pacific (Sydney) Region.
-    """
-    name = 'Amazon EC2 (ap-southeast-2)'
-    _region = 'ap-southeast-2'
-
-
 class EucConnection(EC2Connection):
     """
     Connection class for Eucalyptus

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a7337fed/libcloud/compute/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/providers.py b/libcloud/compute/providers.py
index dfe7e5d..687a653 100644
--- a/libcloud/compute/providers.py
+++ b/libcloud/compute/providers.py
@@ -18,7 +18,7 @@ Provider related utilities
 
 from libcloud.utils.misc import get_driver as _get_provider_driver
 from libcloud.utils.misc import set_driver as _set_provider_driver
-from libcloud.compute.types import Provider, DEPRECATED_RACKSPACE_PROVIDERS
+from libcloud.compute.types import Provider
 from libcloud.compute.types import OLD_CONSTANT_TO_NEW_MAPPING
 from libcloud.compute.deprecated import DEPRECATED_DRIVERS
 
@@ -32,46 +32,12 @@ DRIVERS = {
     ('libcloud.compute.drivers.azure', 'AzureNodeDriver'),
     Provider.DUMMY:
     ('libcloud.compute.drivers.dummy', 'DummyNodeDriver'),
-    Provider.EC2_US_EAST:
+    Provider.EC2:
     ('libcloud.compute.drivers.ec2', 'EC2NodeDriver'),
-    Provider.EC2_EU_WEST:
-    ('libcloud.compute.drivers.ec2', 'EC2EUNodeDriver'),
-    Provider.EC2_US_WEST:
-    ('libcloud.compute.drivers.ec2', 'EC2USWestNodeDriver'),
-    Provider.EC2_US_WEST_OREGON:
-    ('libcloud.compute.drivers.ec2', 'EC2USWestOregonNodeDriver'),
-    Provider.EC2_AP_SOUTHEAST:
-    ('libcloud.compute.drivers.ec2', 'EC2APSENodeDriver'),
-    Provider.EC2_AP_NORTHEAST:
-    ('libcloud.compute.drivers.ec2', 'EC2APNENodeDriver'),
-    Provider.EC2_AP_NORTHEAST1:
-    ('libcloud.compute.drivers.ec2', 'EC2APNE1NodeDriver'),
-    Provider.EC2_AP_NORTHEAST2:
-    ('libcloud.compute.drivers.ec2', 'EC2APNE2NodeDriver'),
-    Provider.EC2_SA_EAST:
-    ('libcloud.compute.drivers.ec2', 'EC2SAEastNodeDriver'),
-    Provider.EC2_AP_SOUTHEAST2:
-    ('libcloud.compute.drivers.ec2', 'EC2APSESydneyNodeDriver'),
     Provider.ECP:
     ('libcloud.compute.drivers.ecp', 'ECPNodeDriver'),
     Provider.ELASTICHOSTS:
     ('libcloud.compute.drivers.elastichosts', 'ElasticHostsNodeDriver'),
-    Provider.ELASTICHOSTS_UK1:
-    ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUK1NodeDriver'),
-    Provider.ELASTICHOSTS_UK2:
-    ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUK2NodeDriver'),
-    Provider.ELASTICHOSTS_US1:
-    ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUS1NodeDriver'),
-    Provider.ELASTICHOSTS_US2:
-    ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUS2NodeDriver'),
-    Provider.ELASTICHOSTS_US3:
-    ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUS3NodeDriver'),
-    Provider.ELASTICHOSTS_CA1:
-    ('libcloud.compute.drivers.elastichosts', 'ElasticHostsCA1NodeDriver'),
-    Provider.ELASTICHOSTS_AU1:
-    ('libcloud.compute.drivers.elastichosts', 'ElasticHostsAU1NodeDriver'),
-    Provider.ELASTICHOSTS_CN1:
-    ('libcloud.compute.drivers.elastichosts', 'ElasticHostsCN1NodeDriver'),
     Provider.SKALICLOUD:
     ('libcloud.compute.drivers.skalicloud', 'SkaliCloudNodeDriver'),
     Provider.SERVERLOVE:
@@ -175,21 +141,22 @@ DRIVERS = {
     ('libcloud.compute.drivers.ntta', 'NTTAmericaNodeDriver'),
     Provider.ALIYUN_ECS:
     ('libcloud.compute.drivers.ecs', 'ECSDriver'),
-
-    # Deprecated
-    Provider.CLOUDSIGMA_US:
-    ('libcloud.compute.drivers.cloudsigma', 'CloudSigmaLvsNodeDriver'),
 }
 
+DEPRECTATED_PROVIDER_CONSTANTS = OLD_CONSTANT_TO_NEW_MAPPING.keys()
+
 
 def get_driver(provider):
+    # Those providers have been shut down or similar.
     if provider in DEPRECATED_DRIVERS:
         url = DEPRECATED_DRIVERS[provider]['url']
         reason = DEPRECATED_DRIVERS[provider]['reason']
         msg = ('Provider no longer supported: %s, please visit: %s' %
                (url, reason))
         raise Exception(msg)
-    if provider in DEPRECATED_RACKSPACE_PROVIDERS:
+
+    # Those drivers have moved to "region" constructor argument model
+    if provider in DEPRECTATED_PROVIDER_CONSTANTS:
         id_to_name_map = dict([(v, k) for k, v in Provider.__dict__.items()])
         old_name = id_to_name_map[provider]
         new_name = id_to_name_map[OLD_CONSTANT_TO_NEW_MAPPING[provider]]

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a7337fed/libcloud/compute/types.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py
index eb19bf8..17f9ef5 100644
--- a/libcloud/compute/types.py
+++ b/libcloud/compute/types.py
@@ -30,7 +30,6 @@ __all__ = [
     "MalformedResponseError",
     "InvalidCredsError",
     "InvalidCredsException",
-    "DEPRECATED_RACKSPACE_PROVIDERS",
     "OLD_CONSTANT_TO_NEW_MAPPING"
 ]
 
@@ -168,7 +167,13 @@ class Provider(Type):
     KILI = 'kili'
     ONAPP = 'onapp'
 
-    # Deprecated constants which are still supported
+    # Deprecated constants which aren't supported anymore
+    RACKSPACE_UK = 'rackspace_uk'
+    RACKSPACE_NOVA_BETA = 'rackspace_nova_beta'
+    RACKSPACE_NOVA_DFW = 'rackspace_nova_dfw'
+    RACKSPACE_NOVA_LON = 'rackspace_nova_lon'
+    RACKSPACE_NOVA_ORD = 'rackspace_nova_ord'
+
     EC2_US_EAST = 'ec2_us_east'
     EC2_EU = 'ec2_eu_west'  # deprecated name
     EC2_EU_WEST = 'ec2_eu_west'
@@ -192,13 +197,6 @@ class Provider(Type):
 
     CLOUDSIGMA_US = 'cloudsigma_us'
 
-    # Deprecated constants which aren't supported anymore
-    RACKSPACE_UK = 'rackspace_uk'
-    RACKSPACE_NOVA_BETA = 'rackspace_nova_beta'
-    RACKSPACE_NOVA_DFW = 'rackspace_nova_dfw'
-    RACKSPACE_NOVA_LON = 'rackspace_nova_lon'
-    RACKSPACE_NOVA_ORD = 'rackspace_nova_ord'
-
     # Removed
     # SLICEHOST = 'slicehost'
 
@@ -209,13 +207,38 @@ DEPRECATED_RACKSPACE_PROVIDERS = [Provider.RACKSPACE_UK,
                                   Provider.RACKSPACE_NOVA_LON,
                                   Provider.RACKSPACE_NOVA_ORD]
 OLD_CONSTANT_TO_NEW_MAPPING = {
+    # Rackspace
     Provider.RACKSPACE: Provider.RACKSPACE_FIRST_GEN,
     Provider.RACKSPACE_UK: Provider.RACKSPACE_FIRST_GEN,
 
     Provider.RACKSPACE_NOVA_BETA: Provider.RACKSPACE,
     Provider.RACKSPACE_NOVA_DFW: Provider.RACKSPACE,
     Provider.RACKSPACE_NOVA_LON: Provider.RACKSPACE,
-    Provider.RACKSPACE_NOVA_ORD: Provider.RACKSPACE
+    Provider.RACKSPACE_NOVA_ORD: Provider.RACKSPACE,
+
+    # AWS
+    Provider.EC2_US_EAST: Provider.EC2,
+    Provider.EC2_EU: Provider.EC2,
+    Provider.EC2_EU_WEST: Provider.EC2,
+    Provider.EC2_US_WEST: Provider.EC2,
+    Provider.EC2_AP_SOUTHEAST: Provider.EC2,
+    Provider.EC2_AP_SOUTHEAST2: Provider.EC2,
+    Provider.EC2_AP_NORTHEAST: Provider.EC2,
+    Provider.EC2_AP_NORTHEAST1: Provider.EC2,
+    Provider.EC2_AP_NORTHEAST2: Provider.EC2,
+    Provider.EC2_US_WEST_OREGON: Provider.EC2,
+    Provider.EC2_SA_EAST: Provider.EC2,
+    Provider.EC2_AP_SOUTHEAST: Provider.EC2,
+
+    # ElasticHosts
+    Provider.ELASTICHOSTS_UK1: Provider.ELASTICHOSTS,
+    Provider.ELASTICHOSTS_UK2: Provider.ELASTICHOSTS,
+    Provider.ELASTICHOSTS_US1: Provider.ELASTICHOSTS,
+    Provider.ELASTICHOSTS_US2: Provider.ELASTICHOSTS,
+    Provider.ELASTICHOSTS_US3: Provider.ELASTICHOSTS,
+    Provider.ELASTICHOSTS_CA1: Provider.ELASTICHOSTS,
+    Provider.ELASTICHOSTS_AU1: Provider.ELASTICHOSTS,
+    Provider.ELASTICHOSTS_CN1: Provider.ELASTICHOSTS,
 }
 
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a7337fed/libcloud/storage/drivers/cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py
index ef854fc..16d6d16 100644
--- a/libcloud/storage/drivers/cloudfiles.py
+++ b/libcloud/storage/drivers/cloudfiles.py
@@ -885,19 +885,6 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin):
         return kwargs
 
 
-class CloudFilesUSStorageDriver(CloudFilesStorageDriver):
-    """
-    Cloudfiles storage driver for the US endpoint.
-    """
-
-    type = Provider.CLOUDFILES_US
-    name = 'CloudFiles (US)'
-
-    def __init__(self, *args, **kwargs):
-        kwargs['region'] = 'ord'
-        super(CloudFilesUSStorageDriver, self).__init__(*args, **kwargs)
-
-
 class OpenStackSwiftStorageDriver(CloudFilesStorageDriver):
     """
     Storage driver for the OpenStack Swift.
@@ -919,19 +906,6 @@ class OpenStackSwiftStorageDriver(CloudFilesStorageDriver):
                                                           **kwargs)
 
 
-class CloudFilesUKStorageDriver(CloudFilesStorageDriver):
-    """
-    Cloudfiles storage driver for the UK endpoint.
-    """
-
-    type = Provider.CLOUDFILES_UK
-    name = 'CloudFiles (UK)'
-
-    def __init__(self, *args, **kwargs):
-        kwargs['region'] = 'lon'
-        super(CloudFilesUKStorageDriver, self).__init__(*args, **kwargs)
-
-
 class FileChunkReader(object):
     def __init__(self, file_path, chunk_size):
         self.file_path = file_path

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a7337fed/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 2356230..adc8e3d 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -23,13 +23,6 @@ from libcloud.utils.iso8601 import UTC
 from libcloud.utils.py3 import httplib
 
 from libcloud.compute.drivers.ec2 import EC2NodeDriver
-from libcloud.compute.drivers.ec2 import EC2USWestNodeDriver
-from libcloud.compute.drivers.ec2 import EC2USWestOregonNodeDriver
-from libcloud.compute.drivers.ec2 import EC2EUNodeDriver
-from libcloud.compute.drivers.ec2 import EC2APSENodeDriver
-from libcloud.compute.drivers.ec2 import EC2APNENodeDriver
-from libcloud.compute.drivers.ec2 import EC2APSESydneyNodeDriver
-from libcloud.compute.drivers.ec2 import EC2SAEastNodeDriver
 from libcloud.compute.drivers.ec2 import EC2PlacementGroup
 from libcloud.compute.drivers.ec2 import NimbusNodeDriver, EucNodeDriver
 from libcloud.compute.drivers.ec2 import OutscaleSASNodeDriver
@@ -1189,47 +1182,6 @@ class EC2SAEastTests(EC2Tests):
     region = 'sa-east-1'
 
 
-# Tests for the old, deprecated way of instantiating a driver.
-class EC2OldStyleModelTests(EC2Tests):
-    driver_klass = EC2USWestNodeDriver
-
-    def setUp(self):
-        EC2MockHttp.test = self
-        EC2NodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
-        EC2MockHttp.use_param = 'Action'
-        EC2MockHttp.type = None
-
-        self.driver = self.driver_klass(*EC2_PARAMS)
-
-
-class EC2USWest1OldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2USWestNodeDriver
-
-
-class EC2USWest2OldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2USWestOregonNodeDriver
-
-
-class EC2EUWestOldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2EUNodeDriver
-
-
-class EC2APSE1OldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2APSENodeDriver
-
-
-class EC2APNEOldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2APNENodeDriver
-
-
-class EC2APSE2OldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2APSESydneyNodeDriver
-
-
-class EC2SAEastOldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2SAEastNodeDriver
-
-
 class EC2MockHttp(MockHttpTestCase):
     fixtures = ComputeFileFixtures('ec2')
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a7337fed/libcloud/test/compute/test_rackspace.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_rackspace.py b/libcloud/test/compute/test_rackspace.py
index e24b873..d5e46cb 100644
--- a/libcloud/test/compute/test_rackspace.py
+++ b/libcloud/test/compute/test_rackspace.py
@@ -17,7 +17,7 @@ import unittest
 
 from libcloud.utils.py3 import method_type
 from libcloud.utils.py3 import httplib
-from libcloud.compute.providers import DEPRECATED_RACKSPACE_PROVIDERS
+from libcloud.compute.types import Provider
 from libcloud.compute.providers import get_driver
 from libcloud.compute.drivers.rackspace import RackspaceFirstGenNodeDriver
 from libcloud.compute.drivers.rackspace import RackspaceNodeDriver
@@ -29,6 +29,12 @@ from libcloud.pricing import clear_pricing_data
 from libcloud.test.secrets import RACKSPACE_NOVA_PARAMS
 from libcloud.test.secrets import RACKSPACE_PARAMS
 
+DEPRECATED_RACKSPACE_PROVIDERS = [Provider.RACKSPACE_UK,
+                                  Provider.RACKSPACE_NOVA_BETA,
+                                  Provider.RACKSPACE_NOVA_DFW,
+                                  Provider.RACKSPACE_NOVA_LON,
+                                  Provider.RACKSPACE_NOVA_ORD]
+
 
 class RackspaceusFirstGenUsTests(OpenStack_1_0_Tests):
     should_list_locations = True


Mime
View raw message