Module: check_mk
Branch: master
Commit: d1d8fe42a5f0027fcb5d6d974299c50490e6686e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d1d8fe42a5f002…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 29 08:53:02 2016 +0200
Fixed exception in WATO web API introduced by changes some weeks ago
---
web/htdocs/htmllib.py | 7 +++++--
web/htdocs/webapi.py | 8 ++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 7a5a746..5226135 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -377,11 +377,14 @@ class html(GUITester):
# The concept is that the user can either provide the data in a single
"request" variable,
# which contains the request data encoded as JSON, or provide multiple GET/POST vars
which
# are then used as top level entries in the request object.
- def get_request(self):
+ def get_request(self, exclude_vars=None):
+ if exclude_vars == None:
+ exclude_vars = []
+
request = json.loads(self.var("request", "{}"))
for key, val in self.all_vars().items():
- if key not in [ "request", "output_format" ]:
+ if key not in [ "request", "output_format" ] +
exclude_vars:
request[key] = val
return request
diff --git a/web/htdocs/webapi.py b/web/htdocs/webapi.py
index 34b18e2..a14cdc8 100644
--- a/web/htdocs/webapi.py
+++ b/web/htdocs/webapi.py
@@ -83,11 +83,11 @@ def page_api():
# Most of the time the request is given as json
# However, the plugin may have an own mechanism to interpret the request
request_object = {}
- if html.var("request"):
- if api_actions[action].get("dont_eval_request"):
+ if api_actions[action].get("dont_eval_request"):
+ if html.var("request"):
request_object = html.var("request")
- else:
- request_object = html.get_request()
+ else:
+ request_object = html.get_request(exclude_vars=["action"])
if api_actions[action].get("locking", True):
lock_exclusive() # unlock is done automatically