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.
pull/10296/head
Michael Scherer 9 years ago committed by Brian Coca
parent fae492324e
commit cdef2f5db6

@ -100,7 +100,7 @@ def gce_connect(module, provider=None):
module.fail_json(msg='Using JSON credentials but libcloud minimum version not met. ' module.fail_json(msg='Using JSON credentials but libcloud minimum version not met. '
'Upgrade to libcloud>=0.17.0.') 'Upgrade to libcloud>=0.17.0.')
return None return None
except ValueError, e: except ValueError as e:
# Not JSON # Not JSON
pass pass
@ -114,9 +114,9 @@ def gce_connect(module, provider=None):
project=project_id) project=project_id)
gce.connection.user_agent_append("%s/%s" % ( gce.connection.user_agent_append("%s/%s" % (
USER_AGENT_PRODUCT, USER_AGENT_VERSION)) USER_AGENT_PRODUCT, USER_AGENT_VERSION))
except (RuntimeError, ValueError), e: except (RuntimeError, ValueError) as e:
module.fail_json(msg=str(e), changed=False) 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) module.fail_json(msg=unexpected_error_msg(e), changed=False)
return gce return gce

Loading…
Cancel
Save