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:
Toshio Kuratomi 2018-09-07 17:59:46 -07:00
commit 3fba006207
320 changed files with 659 additions and 656 deletions

View file

@ -124,7 +124,7 @@ def create_bucket(module, blade):
attr.account = Reference(name=module.params['account'])
blade.buckets.create_buckets(names=[module.params['name']], account=attr)
changed = True
except:
except Exception:
module.fail_json(msg='Object Store Bucket {0}: Creation failed'.format(module.params['name']))
module.exit_json(changed=changed)
@ -140,9 +140,9 @@ def delete_bucket(module, blade):
try:
blade.buckets.delete_buckets(names=[module.params['name']])
changed = True
except:
except Exception:
module.fail_json(msg='Object Store Bucket {0}: Eradication failed'.format(module.params['name']))
except:
except Exception:
module.fail_json(msg='Object Store Bucket {0}: Deletion failed'.format(module.params['name']))
module.exit_json(changed=changed)
@ -154,7 +154,7 @@ def recover_bucket(module, blade):
blade.buckets.update_buckets(names=[module.params['name']],
destroyed=Bucket(destroyed=False))
changed = True
except:
except Exception:
module.fail_json(msg='Object Store Bucket {0}: Recovery failed'.format(module.params['name']))
module.exit_json(changed=changed)
@ -165,7 +165,7 @@ def eradicate_bucket(module, blade):
try:
blade.buckets.delete_buckets(names=[module.params['name']])
changed = True
except:
except Exception:
module.fail_json(msg='Object Store Bucket {0}: Eradication failed'.format(module.params['name']))
module.exit_json(changed=changed)