Module: check_mk
Branch: master
Commit: 9b70e4124cc395d18d6ebd79370c6d4e7a161087
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9b70e4124cc395…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu May 18 09:16:46 2017 +0200
4724 FIX Web-API: Fixed create_folder parameter of add_host call
The call was always creating missing folders regardless of the create_folder
parameter.
Change-Id: I5af15ac3959bc5a6c88d5fcf0c842401b908e96d
---
.werks/4724 | 12 ++++++++++++
web/plugins/webapi/webapi.py | 5 +----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/.werks/4724 b/.werks/4724
new file mode 100644
index 0000000..628d746
--- /dev/null
+++ b/.werks/4724
@@ -0,0 +1,12 @@
+Title: Web-API: Fixed create_folder parameter of add_host call
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1495091774
+
+The call was always creating missing folders regardless of the create_folder
+parameter.
diff --git a/web/plugins/webapi/webapi.py b/web/plugins/webapi/webapi.py
index 2f07a5f..1674cca 100644
--- a/web/plugins/webapi/webapi.py
+++ b/web/plugins/webapi/webapi.py
@@ -108,10 +108,7 @@ def action_add_host(request):
validate_request_keys(request, required_keys=["hostname",
"folder"],
optional_keys=["attributes",
"nodes", "create_folders"])
- if html.var("create_folders"):
- create_folders = bool(int(html.var("create_folders")))
- else:
- create_folders = True
+ create_folders = int(request.get("create_folders")) == 1
hostname = request.get("hostname")
folder_path = request.get("folder")