Module: check_mk
Branch: master
Commit: da2b42875499bfad963e4852f48ca92c5c816da4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=da2b42875499bf…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sun Feb 24 17:53:39 2019 +0100
More specific exception catching
Change-Id: I55fbb0a8d66a3652de833c6193c18175bd6fd6f1
---
cmk/gui/watolib/automations.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmk/gui/watolib/automations.py b/cmk/gui/watolib/automations.py
index c0d836a..9867575 100644
--- a/cmk/gui/watolib/automations.py
+++ b/cmk/gui/watolib/automations.py
@@ -130,7 +130,7 @@ def check_mk_local_automation(command, args=None, indata="",
stdin_data=None, ti
try:
return ast.literal_eval(outdata)
- except Exception as e:
+ except SyntaxError as e:
raise MKGeneralException(
"Error running <tt>%s</tt>. Invalid output from webservice
(%s): <pre>%s</pre>" %
(" ".join(cmd), e, outdata))
@@ -253,7 +253,7 @@ def do_remote_automation(site, command, vars_, timeout=None):
try:
response = ast.literal_eval(response)
- except:
+ except SyntaxError:
# The remote site will send non-Python data in case of an error.
raise MKAutomationException("%s: <pre>%s</pre>" %
(_("Got invalid data"), response))
@@ -317,5 +317,5 @@ def do_site_login(site_id, name, password):
else:
try:
return ast.literal_eval(response)
- except:
+ except SyntaxError:
raise MKAutomationException(response)