[checkmk-commits] Check_MK Git: check_mk: #1946 FIX WATO Web-API: edit host action does no longer unset all unspecified attributes

Andreas Boesl ab at mathias-kettner.de
Mon Feb 23 09:17:48 CET 2015


Module: check_mk
Branch: master
Commit: 1310cc4deee4946007fa80ee4b61887fef158eb8
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1310cc4deee4946007fa80ee4b61887fef158eb8

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Mon Feb 23 09:17:11 2015 +0100

#1946 FIX WATO Web-API: edit host action does no longer unset all unspecified attributes

The edit_host call is able to set and unset the attributes of a specific hosts without errors.
Previously any unmentioned attributes got automatically unset.

---

 .werks/1946        |   12 ++++++++++++
 ChangeLog          |    1 +
 web/htdocs/wato.py |    6 +++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/.werks/1946 b/.werks/1946
new file mode 100644
index 0000000..3a25db4
--- /dev/null
+++ b/.werks/1946
@@ -0,0 +1,12 @@
+Title: WATO Web-API: edit host action does no longer unset all unspecified attributes
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1424679033
+
+The edit_host call is able to set and unset the attributes of a specific hosts without errors.
+Previously any unmentioned attributes got automatically unset.
+
diff --git a/ChangeLog b/ChangeLog
index 8bb201f..f3f7655 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -255,6 +255,7 @@
     * 2009 FIX: Fixed styling of site login page for establishing a distributed monitoring WATO sync...
     * 2003 FIX: Fix saving of "Users are allowed to directly login into the Web GUI of this site"...
     * 2010 FIX: Improved error message when trying to add group assignment rule without having a group configured
+    * 1946 FIX: WATO Web-API: edit host action does no longer unset all unspecified attributes...
 
     Notifications:
     * 1662 notification plugin spectrum: finalized script. now able to handle host notications
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 919cff6..4cbfe4b 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -17848,7 +17848,11 @@ class API:
                 self.__validate_host_parameters(None, hostname, attributes, all_hosts, True,
                                            ["host_missing", "tags", "site", "permissions_edit"])
             host_foldername = all_hosts[hostname][".folder"][".path"]
-            target_folders.setdefault(host_foldername, {})[hostname] = {"set":   attributes,
+            new_attr = dict([(k, v) for (k, v) in all_hosts[hostname].iteritems() \
+                                    if (not k.startswith('.'))])
+            new_attr.update(attributes)
+
+            target_folders.setdefault(host_foldername, {})[hostname] = {"set":   new_attr,
                                                                         "unset": host_unset_attr}
 
         for target_foldername, update_hosts in target_folders.items():



More information about the checkmk-commits mailing list