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 <[email protected]> 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 <[email protected]> Authored: Mon May 14 14:54:35 2018 -0600 Committer: Quentin Pradet <[email protected]> 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'
