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

Fix gce module to compile on python 3 (#3179)

This commit is contained in:
Michael Scherer 2016-10-15 17:36:44 +02:00 committed by Matt Clay
parent da6851bdf4
commit 11d88bc1a8
2 changed files with 4 additions and 2 deletions

View file

@ -166,7 +166,8 @@ def create_image(gce, name, module):
return True return True
except ResourceExistsError: except ResourceExistsError:
return False return False
except GoogleBaseError, e: except GoogleBaseError:
e = get_exception()
module.fail_json(msg=str(e), changed=False) module.fail_json(msg=str(e), changed=False)
finally: finally:
gce.connection.timeout = old_timeout gce.connection.timeout = old_timeout

View file

@ -156,7 +156,8 @@ def remove_tags(gce, module, instance_name, tags):
node = gce.ex_get_node(instance_name, zone=zone) node = gce.ex_get_node(instance_name, zone=zone)
except ResourceNotFoundError: except ResourceNotFoundError:
module.fail_json(msg='Instance %s not found in zone %s' % (instance_name, zone), changed=False) module.fail_json(msg='Instance %s not found in zone %s' % (instance_name, zone), changed=False)
except GoogleBaseError, e: except GoogleBaseError:
e = get_exception()
module.fail_json(msg=str(e), changed=False) module.fail_json(msg=str(e), changed=False)
node_tags = node.extra['tags'] node_tags = node.extra['tags']