mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +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:
@@ -96,7 +96,7 @@ import traceback
|
||||
try:
|
||||
from datadog import initialize, api
|
||||
HAS_DATADOG = True
|
||||
except:
|
||||
except Exception:
|
||||
HAS_DATADOG = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
@@ -144,7 +144,7 @@ import traceback
|
||||
try:
|
||||
from datadog import initialize, api
|
||||
HAS_DATADOG = True
|
||||
except:
|
||||
except Exception:
|
||||
HAS_DATADOG = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
@@ -867,7 +867,7 @@ class Collector(LogicMonitor):
|
||||
"arch": arch}))
|
||||
with open(installfilepath, "w") as write_file:
|
||||
write_file.write(installer)
|
||||
except:
|
||||
except Exception:
|
||||
self.fail(msg="Unable to open installer file for writing")
|
||||
else:
|
||||
self.module.debug("Collector installer already exists")
|
||||
|
||||
@@ -222,7 +222,7 @@ class PagerDutyRequest(object):
|
||||
def _read_response(self, response):
|
||||
try:
|
||||
return json.loads(response.read())
|
||||
except:
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ EXAMPLES = '''
|
||||
try:
|
||||
import pingdom
|
||||
HAS_PINGDOM = True
|
||||
except:
|
||||
except Exception:
|
||||
HAS_PINGDOM = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
@@ -130,7 +130,7 @@ def query(module, url, check, subscription):
|
||||
|
||||
try:
|
||||
json_out = json.loads(response.read())
|
||||
except:
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
return False, json_out, False
|
||||
@@ -182,7 +182,7 @@ def clear(module, url, check, subscription):
|
||||
|
||||
try:
|
||||
json_out = json.loads(response.read())
|
||||
except:
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
return False, json_out, True
|
||||
@@ -247,7 +247,7 @@ def create(
|
||||
|
||||
try:
|
||||
json_out = json.loads(response.read())
|
||||
except:
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
return False, json_out, True
|
||||
|
||||
Reference in New Issue
Block a user