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
|
@ -135,7 +135,7 @@ def get_volume(module, array):
|
|||
"""Return Volume or None"""
|
||||
try:
|
||||
return array.get_volume(module.params['name'])
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
|
@ -146,7 +146,7 @@ def get_destroyed_volume(module, array):
|
|||
return True
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
|
@ -154,7 +154,7 @@ def get_target(module, array):
|
|||
"""Return Volume or None"""
|
||||
try:
|
||||
return array.get_volume(module.params['target'])
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
|
@ -167,7 +167,7 @@ def create_volume(module, array):
|
|||
array.create_volume(module.params['name'], module.params['size'],
|
||||
bandwidth_limit=module.params['qos'])
|
||||
changed = True
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Volume {0} creation failed.'.format(module.params['name']))
|
||||
else:
|
||||
module.fail_json(msg='QoS value {0} out of range.'.format(module.params['qos']))
|
||||
|
@ -175,7 +175,7 @@ def create_volume(module, array):
|
|||
try:
|
||||
array.create_volume(module.params['name'], module.params['size'])
|
||||
changed = True
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Volume {0} creation failed.'.format(module.params['name']))
|
||||
|
||||
module.exit_json(changed=changed)
|
||||
|
@ -192,7 +192,7 @@ def copy_from_volume(module, array):
|
|||
array.copy_volume(module.params['name'],
|
||||
module.params['target'])
|
||||
changed = True
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Copy volume {0} to volume {1} failed.'.format(module.params['name'],
|
||||
module.params['target']))
|
||||
elif tgt is not None and module.params['overwrite']:
|
||||
|
@ -201,7 +201,7 @@ def copy_from_volume(module, array):
|
|||
module.params['target'],
|
||||
overwrite=module.params['overwrite'])
|
||||
changed = True
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Copy volume {0} to volume {1} failed.'.format(module.params['name'],
|
||||
module.params['target']))
|
||||
|
||||
|
@ -221,7 +221,7 @@ def update_volume(module, array):
|
|||
try:
|
||||
array.extend_volume(module.params['name'], module.params['size'])
|
||||
changed = True
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Volume {0} resize failed.'.format(module.params['name']))
|
||||
if module.params['qos']:
|
||||
if human_to_bytes(module.params['qos']) != vol_qos['bandwidth_limit']:
|
||||
|
@ -230,7 +230,7 @@ def update_volume(module, array):
|
|||
array.set_volume(module.params['name'],
|
||||
bandwidth_limit=module.params['qos'])
|
||||
changed = True
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Volume {0} QoS change failed.'.format(module.params['name']))
|
||||
else:
|
||||
module.fail_json(msg='QoS value {0} out of range. Check documentation.'.format(module.params['qos']))
|
||||
|
@ -247,10 +247,10 @@ def delete_volume(module, array):
|
|||
if module.params['eradicate']:
|
||||
try:
|
||||
array.eradicate_volume(module.params['name'])
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Eradicate volume {0} failed.'.format(module.params['name']))
|
||||
changed = True
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Delete volume {0} failed.'.format(module.params['name']))
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
|
@ -261,7 +261,7 @@ def eradicate_volume(module, array):
|
|||
try:
|
||||
array.eradicate_volume(module.params['name'])
|
||||
changed = True
|
||||
except:
|
||||
except Exception:
|
||||
module.fail_json(msg='Eradication of volume {0} failed'.format(module.params['name']))
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue