Module: check_mk
Branch: master
Commit: ccbaa70428f3373b79aba545d8f6510ab9d40fd2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ccbaa70428f337…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu May 18 08:35:22 2017 +0200
4723 FIX Web-API: Fixed effective_attributes parameter for get_host/get_all_hosts calls
The parameter effective_attributes was simply ignored. The calls were always
returning the explicitly configured attributes.
Change-Id: If56cd11798526aea9015e6ba6b316315fc2f2b19
---
.werks/4723 | 12 ++++++++++++
web/plugins/webapi/webapi.py | 8 +++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/.werks/4723 b/.werks/4723
new file mode 100644
index 0000000..dadaa1d
--- /dev/null
+++ b/.werks/4723
@@ -0,0 +1,12 @@
+Title: Web-API: Fixed effective_attributes parameter for get_host/get_all_hosts calls
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1495089250
+
+The parameter effective_attributes was simply ignored. The calls were always
+returning the explicitly configured attributes.
diff --git a/web/plugins/webapi/webapi.py b/web/plugins/webapi/webapi.py
index 4a8ff22..2f07a5f 100644
--- a/web/plugins/webapi/webapi.py
+++ b/web/plugins/webapi/webapi.py
@@ -201,7 +201,8 @@ def action_get_host(request):
host = Host.host(hostname)
host.need_permission("read")
- if html.var("effective_attributes") == "1":
+
+ if int(request.get("effective_attributes")) == 1:
attributes = host.effective_attributes()
else:
attributes = host.attributes()
@@ -221,10 +222,7 @@ api_actions["get_host"] = {
def action_get_all_hosts(request):
validate_request_keys(request, optional_keys=["effective_attributes"])
- if html.var("effective_attributes"):
- effective_attributes = bool(int(html.var("effective_attributes")))
- else:
- effective_attributes = False
+ effective_attributes = int(request.get("effective_attributes")) == 1
response = {}
all_hosts = Folder.root_folder().all_hosts_recursively()