libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quent...@apache.org
Subject [4/9] libcloud git commit: Make sure simply qualified subnet works too
Date Fri, 19 Jan 2018 20:25:12 GMT
Make sure simply qualified subnet works too

Signed-off-by: Quentin Pradet <quentinp@apache.org>


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

Branch: refs/heads/trunk
Commit: f5cd7e6b50de2db5bf8e6c8d6924de7135aa24f1
Parents: 40fb1af
Author: Boris Chazalet <bchazalet@companywatch.net>
Authored: Thu Jan 18 10:18:36 2018 +0100
Committer: Quentin Pradet <quentinp@apache.org>
Committed: Sat Jan 20 00:22:53 2018 +0400

----------------------------------------------------------------------
 libcloud/compute/drivers/gce.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f5cd7e6b/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 5e182ff..aa4c50f 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -7073,9 +7073,10 @@ class GCENodeDriver(NodeDriver):
         """
         region_name = None
         if name.startswith('https://'):
-            parts = self._get_components_from_path(name)
+            #parts = self._get_components_from_path(name)
             #name = parts['name']
-            region_name = parts['region']
+            #region_name = parts['region']
+            request = name
         else:
             if isinstance(region, GCERegion):
                 region_name = region.name
@@ -7085,15 +7086,16 @@ class GCENodeDriver(NodeDriver):
                 else:
                     region_name = region
 
-        if not region_name:
-            region = self._set_region(region)
-            if not region:
-                raise ValueError("Could not determine region for subnetwork.")
-            else:
-                region_name = region.name
+            if not region_name:
+                region = self._set_region(region)
+                if not region:
+                    raise ValueError("Could not determine region for subnetwork.")
+                else:
+                    region_name = region.name
+
+            request = '/regions/%s/subnetworks/%s' % (region_name, name)
 
-        #request = '/regions/%s/subnetworks/%s' % (region_name, name)
-        request = '%s' % (name)
+        # request = '/regions/%s/subnetworks/%s' % (region_name, name)
         response = self.connection.request(request, method='GET').object
         return self._to_subnetwork(response)
 


Mime
View raw message