summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2018-09-09 22:16:05 -0700
committerToshio Kuratomi <a.badger@gmail.com>2018-12-16 15:03:19 -0800
commit175f3b51e528f72068d6e167d4f7892bc132a380 (patch)
treeadf6873a2580b52c130b22901559781a5619848f /contrib
parent3fba0062078cc04eabb460ec1eb13a4739235199 (diff)
downloadansible-175f3b51e528f72068d6e167d4f7892bc132a380.tar.gz
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.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/inventory/zabbix.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/inventory/zabbix.py b/contrib/inventory/zabbix.py
index 8de20ea582..43a539a006 100755
--- a/contrib/inventory/zabbix.py
+++ b/contrib/inventory/zabbix.py
@@ -173,7 +173,9 @@ class ZabbixInventory(object):
try:
api = ZabbixAPI(server=self.zabbix_server, validate_certs=self.validate_certs)
api.login(user=self.zabbix_username, password=self.zabbix_password)
- except BaseException as e:
+ # zabbix_api tries to exit if it cannot parse what the zabbix server returned
+ # so we have to use SystemExit here
+ except (Exception, SystemExit) as e:
print("Error: Could not login to Zabbix server. Check your zabbix.ini.", file=sys.stderr)
sys.exit(1)