mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Update bare exceptions to specify Exception.
This will keep us from accidentally catching program-exiting exceptions like KeyboardInterupt and SystemExit.
This commit is contained in:
@@ -117,7 +117,7 @@ def validate_ports(module, ports):
|
||||
if 'port_num' in item:
|
||||
try:
|
||||
item['port_num'] = int(item['port_num'])
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg="port_num entries in the port definitions must be integers")
|
||||
else:
|
||||
module.fail_json(msg="port definitions must define the port_num field")
|
||||
|
||||
@@ -108,7 +108,7 @@ def validate_ports(module, ports):
|
||||
if 'port-number' in item:
|
||||
try:
|
||||
item['port-number'] = int(item['port-number'])
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg="port-number entries in the port definitions must be integers")
|
||||
else:
|
||||
module.fail_json(msg="port definitions must define the port-number field")
|
||||
|
||||
@@ -137,7 +137,7 @@ def validate_servers(module, servers):
|
||||
if 'port' in item:
|
||||
try:
|
||||
item['port'] = int(item['port'])
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg="server port definitions must be integers")
|
||||
else:
|
||||
module.fail_json(msg="server definitions must define the port field")
|
||||
|
||||
@@ -119,7 +119,7 @@ def validate_ports(module, ports):
|
||||
if 'port' in item:
|
||||
try:
|
||||
item['port'] = int(item['port'])
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg="port definitions must be integers")
|
||||
else:
|
||||
module.fail_json(msg="port definitions must define the port field")
|
||||
|
||||
Reference in New Issue
Block a user