Ensure that current uses of BaseException are required

* In some cases, it appears that Exception should have been used instead
  as there's no need to catch sys.exit KeyboardInterrupt and similar.
* In a few cases, it appears that BaseException is used because
  a library we depend on calls sys.exit() contrary to good coding
  design.  Comment those so that we know that those have been audited
  and found to be correct and change to use (Exception, SystemExit)
  instead.
This commit is contained in:
Toshio Kuratomi 2018-09-09 22:16:05 -07:00
commit 175f3b51e5
9 changed files with 31 additions and 20 deletions

View file

@ -513,7 +513,7 @@ def main():
obj.create()
elif changed:
obj.modify()
except BaseException as err:
except Exception as err:
module.fail_json(
msg='Creating/editing share {} in {} failed: {}'.format(
name,
@ -528,7 +528,7 @@ def main():
if not module.check_mode:
obj.remove()
changed = True
except BaseException as err:
except Exception as err:
module.fail_json(
msg='Removing share {} in {} failed: {}'.format(
name,