Fix exception handling to be compatible with Python 3
This commit is contained in:
parent
4b11312737
commit
c8dc0bf5c9
1 changed files with 3 additions and 3 deletions
|
@ -305,7 +305,7 @@ def main():
|
||||||
json_output['subnet_name'] = subnet_name
|
json_output['subnet_name'] = subnet_name
|
||||||
json_output['ipv4_range'] = ipv4_range
|
json_output['ipv4_range'] = ipv4_range
|
||||||
changed = True
|
changed = True
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg=unexpected_error_msg(e), changed=changed)
|
module.fail_json(msg=unexpected_error_msg(e), changed=changed)
|
||||||
|
|
||||||
if fwname:
|
if fwname:
|
||||||
|
@ -411,7 +411,7 @@ def main():
|
||||||
subnet = gce.ex_get_subnetwork(subnet_name, region=subnet_region)
|
subnet = gce.ex_get_subnetwork(subnet_name, region=subnet_region)
|
||||||
except ResourceNotFoundError:
|
except ResourceNotFoundError:
|
||||||
pass
|
pass
|
||||||
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)
|
||||||
if subnet:
|
if subnet:
|
||||||
gce.ex_destroy_subnetwork(subnet)
|
gce.ex_destroy_subnetwork(subnet)
|
||||||
|
@ -430,7 +430,7 @@ def main():
|
||||||
# json_output['d4'] = 'deleting %s' % name
|
# json_output['d4'] = 'deleting %s' % name
|
||||||
try:
|
try:
|
||||||
gce.ex_destroy_network(network)
|
gce.ex_destroy_network(network)
|
||||||
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)
|
||||||
# json_output['d5'] = 'deleted %s' % name
|
# json_output['d5'] = 'deleted %s' % name
|
||||||
changed = True
|
changed = True
|
||||||
|
|
Loading…
Reference in a new issue