Repository: libcloud
Updated Branches:
  refs/heads/trunk 8493954fc -> eefed81a2


Change the behaviour to allow None region type when using host


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

Branch: refs/heads/trunk
Commit: 5b1705379455dd6637359982b8cdd80e5af9bd09
Parents: c471148
Author: anthony-shaw <anthonys...@apache.org>
Authored: Fri May 27 09:46:23 2016 +1000
Committer: anthony-shaw <anthonys...@apache.org>
Committed: Mon Jun 6 21:46:04 2016 +1000

----------------------------------------------------------------------
 libcloud/backup/drivers/dimensiondata.py       | 8 ++++----
 libcloud/compute/drivers/dimensiondata.py      | 8 ++++----
 libcloud/loadbalancer/drivers/dimensiondata.py | 8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/5b170537/libcloud/backup/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/backup/drivers/dimensiondata.py 
b/libcloud/backup/drivers/dimensiondata.py
index 6c869c3..53d054e 100644
--- a/libcloud/backup/drivers/dimensiondata.py
+++ b/libcloud/backup/drivers/dimensiondata.py
@@ -56,10 +56,10 @@ class DimensionDataBackupDriver(BackupDriver):
     def __init__(self, key, secret=None, secure=True, host=None, port=None,
                  api_version=None, region=DEFAULT_REGION, **kwargs):
 
-        if region not in API_ENDPOINTS:
-            raise ValueError('Invalid region: %s' % (region))
-
-        self.selected_region = API_ENDPOINTS[region]
+        if region not in API_ENDPOINTS and host is None:
+            raise ValueError('Invalid region: %s, no host specified' % 
(region))
+        if region is not None:
+            self.selected_region = API_ENDPOINTS[region]
 
         super(DimensionDataBackupDriver, self).__init__(
             key=key, secret=secret,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/5b170537/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py 
b/libcloud/compute/drivers/dimensiondata.py
index a3881f6..56935b6 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -100,10 +100,10 @@ class DimensionDataNodeDriver(NodeDriver):
     def __init__(self, key, secret=None, secure=True, host=None, port=None,
                  api_version=None, region=DEFAULT_REGION, **kwargs):
 
-        if region not in API_ENDPOINTS:
-            raise ValueError('Invalid region: %s' % (region))
-
-        self.selected_region = API_ENDPOINTS[region]
+        if region not in API_ENDPOINTS and host is None:
+            raise ValueError('Invalid region: %s, no host specified' % 
(region))
+        if region is not None:
+            self.selected_region = API_ENDPOINTS[region]
 
         super(DimensionDataNodeDriver, self).__init__(key=key, secret=secret,
                                                       secure=secure, host=host,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/5b170537/libcloud/loadbalancer/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/dimensiondata.py 
b/libcloud/loadbalancer/drivers/dimensiondata.py
index 9c521d8..40a7aa0 100644
--- a/libcloud/loadbalancer/drivers/dimensiondata.py
+++ b/libcloud/loadbalancer/drivers/dimensiondata.py
@@ -75,10 +75,10 @@ class DimensionDataLBDriver(Driver):
     def __init__(self, key, secret=None, secure=True, host=None, port=None,
                  api_version=None, region=DEFAULT_REGION, **kwargs):
 
-        if region not in API_ENDPOINTS:
-            raise ValueError('Invalid region: %s' % (region))
-
-        self.selected_region = API_ENDPOINTS[region]
+        if region not in API_ENDPOINTS and host is None:
+            raise ValueError('Invalid region: %s, no host specified' % 
(region))
+        if region is not None:
+            self.selected_region = API_ENDPOINTS[region]
 
         super(DimensionDataLBDriver, self).__init__(key=key, secret=secret,
                                                     secure=secure, host=host,

Reply via email to