mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07: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:
parent
5147e792d3
commit
3fba006207
320 changed files with 659 additions and 656 deletions
|
@ -93,7 +93,7 @@ msg:
|
|||
try:
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlparse, urlunparse
|
||||
HAS_URLPARSE = True
|
||||
except:
|
||||
except Exception:
|
||||
HAS_URLPARSE = False
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
|
|
@ -275,7 +275,7 @@ def main():
|
|||
if secure == 'always':
|
||||
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' %
|
||||
(host, port, to_native(e)), exception=traceback.format_exc())
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if not secure_state:
|
||||
|
|
|
@ -95,7 +95,7 @@ def send_msg(module):
|
|||
|
||||
try:
|
||||
responses[number] = json.load(response)
|
||||
except:
|
||||
except Exception:
|
||||
failed.append(number)
|
||||
responses[number] = dict(failed=True)
|
||||
else:
|
||||
|
|
|
@ -100,7 +100,7 @@ def main():
|
|||
msg_object = Pushover(module, module.params['user_key'], module.params['app_token'])
|
||||
try:
|
||||
response = msg_object.run(module.params['pri'], module.params['msg'])
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Unable to send msg via pushover')
|
||||
|
||||
module.exit_json(msg='message sent successfully: %s' % response, changed=False)
|
||||
|
|
|
@ -159,7 +159,7 @@ def run_module():
|
|||
syslog.closelog()
|
||||
result['changed'] = True
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(error='Failed to write to syslog', **result)
|
||||
|
||||
module.exit_json(**result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue