1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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:
Michael Scherer 2016-05-16 14:11:31 +02:00 committed by Brian Coca
parent fae492324e
commit cdef2f5db6

View file

@ -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