Module: check_mk
Branch: master
Commit: 4ffad806c2be68e74d410804bf7c204d4d926ad2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4ffad806c2be68…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Sep 3 09:44:48 2015 +0200
#2552 FIX API: Service Discovery action is now creating missing pending log entry and
marks the site dirty
---
.werks/2552 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 22 +++++++++++++++-------
3 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/.werks/2552 b/.werks/2552
new file mode 100644
index 0000000..df6b768
--- /dev/null
+++ b/.werks/2552
@@ -0,0 +1,10 @@
+Title: API: Service Discovery action is now creating missing pending log entry and marks
the site dirty
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1441266258
+
+
diff --git a/ChangeLog b/ChangeLog
index bb8f3cb..f917b2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -213,6 +213,7 @@
* 2499 FIX: Git: Fixed message "Please tell me who you are. Run git config
..." on making changes...
* 2539 FIX: Fix impossibility of removing a status host from an existing site
configuration
* 2550 FIX: Catching exception when having name conflicts while moving a folder
+ * 2552 FIX: API: Service Discovery action is now creating missing pending log entry
and marks the site dirty
Notifications:
* 2478 Integrated notification plugin for mobile phone push messages via Pushover...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index edfe7ce..0bad9b7 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -19120,24 +19120,32 @@ class API:
self.__prepare_folder_info()
all_hosts = self.__get_all_hosts()
+ host = all_hosts[hostname]
+ folder = host[".folder"]
+
config.need_permission("wato.services")
self.__validate_host_parameters(None, hostname, {}, all_hosts, True,
["host_missing"])
- check_host_permissions(hostname, folder =
all_hosts[hostname][".folder"])
+ check_host_permissions(hostname, folder=folder)
### Start inventory
- host = all_hosts[hostname]
counts, failed_hosts = check_mk_automation(host[".siteid"],
"inventory", [ "@scan", mode ] + [hostname])
if failed_hosts:
- if not host.get("inventory_failed") and not
host.get(".folder", {}).get(".lock_hosts"):
+ if not host.get("inventory_failed") and not
folder.get(".lock_hosts"):
host["inventory_failed"] = True
- save_hosts(host[".folder"])
+ save_hosts(folder)
raise MKUserError(None, _("Failed to inventorize %s: %s") %
(hostname, failed_hosts[hostname]))
- if host.get("inventory_failed") and not host.get(".folder",
{}).get(".lock_hosts"):
+ if host.get("inventory_failed") and not
folder.get(".lock_hosts"):
del host["inventory_failed"]
- save_hosts(host[".folder"])
+ save_hosts(folder)
+
+ msg = _("Service discovery successful. Added %d, Removed %d, Kept %d, New
Count %d") % \
+
tuple(counts[hostname])
+
+ mark_affected_sites_dirty(folder, hostname, sync=False, restart=True)
+ log_pending(AFFECTED, hostname, "api-inventory", msg)
- return _("Service discovery successful. Added %d, Removed %d, Kept %d, New
Count %d") % tuple(counts[hostname])
+ return msg
def activate_changes(self, sites, mode = "dirty", allow_foreign_changes =
False):
self.__prepare_folder_info()