Restructure region check to fetch empty region 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/3e62d865 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3e62d865 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3e62d865 Branch: refs/heads/trunk Commit: 3e62d865ac3b9c3b0fbeea4a767f44e589572dbb Parents: 8a3de71 Author: Jeremy Solarz <[email protected]> Authored: Fri Feb 23 10:01:38 2018 +0000 Committer: Quentin Pradet <[email protected]> Committed: Sun Feb 25 09:00:55 2018 +0400 ---------------------------------------------------------------------- libcloud/compute/drivers/gce.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/3e62d865/libcloud/compute/drivers/gce.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index 38ee948..497e24c 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -2856,11 +2856,11 @@ class GCENodeDriver(NodeDriver): :rtype: :class:`GCEAddress` """ region = region or self.region - if region != 'global' and not hasattr(region, 'name'): - region = self.ex_get_region(region) - elif region is None: + if region is None: raise ValueError('REGION_NOT_SPECIFIED', 'Region must be provided for an address') + if region != 'global' and not hasattr(region, 'name'): + region = self.ex_get_region(region) address_data = {'name': name} if address: address_data['address'] = address
