instead of empty string again
Message-ID: <57051aef.GGsyolDw1VhtSAEW%mk(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: b18644e8c7f87d48fa4c7472694652e2ecd70374
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b18644e8c7f87d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 6 16:19:01 2016 +0200
3330 FIX WATO Web-API now allows to specify root folder with / instead of empty string
again
---
.werks/3330 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/webapi/webapi.py | 12 ++++++++----
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/.werks/3330 b/.werks/3330
new file mode 100644
index 0000000..2b2064f
--- /dev/null
+++ b/.werks/3330
@@ -0,0 +1,10 @@
+Title: WATO Web-API now allows to specify root folder with / instead of empty string
again
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1459952317
+
+
diff --git a/ChangeLog b/ChangeLog
index 13bcb10..347830c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -234,6 +234,7 @@
* 3369 FIX: Printing configuration warning when host references itself as parent
* 3371 FIX: Be compatible to old site=None setting read from hosts.mk...
* 3329 FIX: Function discover_services now allows the URL parameter mode...
+ * 3330 FIX: WATO Web-API now allows to specify root folder with / instead of empty
string again
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/plugins/webapi/webapi.py b/web/plugins/webapi/webapi.py
index d39b6d3..19c952a 100644
--- a/web/plugins/webapi/webapi.py
+++ b/web/plugins/webapi/webapi.py
@@ -83,10 +83,14 @@ def action_add_host(request):
# Validate folder
if folder_path == None:
raise MKUserError(None, _("Foldername is missing"))
- folders = folder_path.split("/")
- if folders != [ "" ]:
- for foldername in folders:
- check_wato_foldername(None, foldername, just_name = True)
+
+ if folder_path != "" and folder_path != "/":
+ folders = folder_path.split("/")
+ for foldername in folders:
+ check_wato_foldername(None, foldername, just_name=True)
+ else:
+ folder_path = ""
+ folders = [""]
# Validate and cleanup given attributes
# CLEANUP: modify WebAPI .nodes argument