Port the gce snippet to a python 2.6 to 3 compatible syntax (#15872)
Since it depend on libcloud and libcloud requirements include python 2.6 since libcloud 0.4.0 (https://libcloud.apache.org/about.html), which was released in 2011 Q2, and GCE drivers were added in 2013, we can't run a libcloud version with GCE support on 2.4.
This commit is contained in:
parent
fae492324e
commit
cdef2f5db6
1 changed files with 3 additions and 3 deletions
|
@ -100,7 +100,7 @@ def gce_connect(module, provider=None):
|
|||
module.fail_json(msg='Using JSON credentials but libcloud minimum version not met. '
|
||||
'Upgrade to libcloud>=0.17.0.')
|
||||
return None
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
# Not JSON
|
||||
pass
|
||||
|
||||
|
@ -114,9 +114,9 @@ def gce_connect(module, provider=None):
|
|||
project=project_id)
|
||||
gce.connection.user_agent_append("%s/%s" % (
|
||||
USER_AGENT_PRODUCT, USER_AGENT_VERSION))
|
||||
except (RuntimeError, ValueError), e:
|
||||
except (RuntimeError, ValueError) as e:
|
||||
module.fail_json(msg=str(e), changed=False)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg=unexpected_error_msg(e), changed=False)
|
||||
|
||||
return gce
|
||||
|
|
Loading…
Reference in a new issue