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:
@@ -588,7 +588,7 @@ def main():
|
||||
try:
|
||||
js = json.loads(u_content)
|
||||
uresp['json'] = js
|
||||
except:
|
||||
except Exception:
|
||||
if PY2:
|
||||
sys.exc_clear() # Avoid false positive traceback in fail_json() on Python 2
|
||||
else:
|
||||
|
||||
@@ -173,7 +173,7 @@ import json
|
||||
try:
|
||||
import pynetbox
|
||||
HAS_PYNETBOX = True
|
||||
except:
|
||||
except ImportError:
|
||||
HAS_PYNETBOX = False
|
||||
|
||||
|
||||
|
||||
@@ -632,7 +632,7 @@ class Nmcli(object):
|
||||
for setting in secrets:
|
||||
for key in secrets[setting]:
|
||||
config[setting_name][key] = secrets[setting][key]
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def dict_to_string(self, d):
|
||||
|
||||
@@ -169,7 +169,7 @@ from collections import defaultdict
|
||||
try:
|
||||
from pysnmp.entity.rfc3413.oneliner import cmdgen
|
||||
has_pysnmp = True
|
||||
except:
|
||||
except Exception:
|
||||
has_pysnmp = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
Reference in New Issue
Block a user