libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quent...@apache.org
Subject [1/2] libcloud git commit: [gce] ex_create_network can have NoneType routing_mode
Date Mon, 11 Jun 2018 19:07:40 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 6de9bb4cf -> 125037469


[gce] ex_create_network can have NoneType routing_mode

Check for that before trying string operations on it.

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/93ad4b87
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/93ad4b87
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/93ad4b87

Branch: refs/heads/trunk
Commit: 93ad4b8733604cd1e1ef6162ef9d65344820ff60
Parents: 6de9bb4
Author: Daniel Hunsaker <dan@nanobox.io>
Authored: Mon May 14 14:54:35 2018 -0600
Committer: Quentin Pradet <quentinp@apache.org>
Committed: Mon Jun 11 21:05:34 2018 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/gce.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/93ad4b87/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 484022e..3dfc87d 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -3892,13 +3892,14 @@ class GCENodeDriver(NodeDriver):
         else:
             network_data['autoCreateSubnetworks'] = (mode.lower() == 'auto')
 
-        if routing_mode.lower() not in ['regional', 'global']:
-            raise ValueError("Invalid Routing Mode: '%s'. Must be 'REGIONAL', "
-                             "or 'GLOBAL'." % routing_mode)
-        else:
-            network_data['routingConfig'] = {
-                'routingMode': routing_mode.upper()
-            }
+        if routing_mode:
+            if routing_mode.lower() not in ['regional', 'global']:
+                raise ValueError("Invalid Routing Mode: '%s'. Must be "
+                                 "'REGIONAL', or 'GLOBAL'." % routing_mode)
+            else:
+                network_data['routingConfig'] = {
+                    'routingMode': routing_mode.upper()
+                }
 
         request = '/global/networks'
 


Mime
View raw message