Module: check_mk
Branch: master
Commit: b4298eb942715955b490977c1863e397ff3f8995
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b4298eb9427159…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue May 20 14:21:50 2014 +0200
Host renaming: also deal with parent definitions
---
web/htdocs/wato.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 3732489..2f8caf2 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2331,6 +2331,7 @@ def rename_host(host, newname):
# Is this host node of a cluster?
all_hosts = load_all_hosts()
clusters = []
+ parents = []
for somehost in all_hosts.values():
if ".nodes" in somehost:
nodes = somehost[".nodes"]
@@ -2340,9 +2341,19 @@ def rename_host(host, newname):
save_folder_and_hosts(folder)
mark_affected_sites_dirty(folder)
+ if somehost.get("parents"):
+ if rename_host_in_list(somehost["parents"], oldname, newname):
+ parents.append(somehost[".name"])
+ folder = somehost['.folder']
+ save_folder_and_hosts(folder)
+ mark_affected_sites_dirty(folder)
+
if clusters:
actions.append(_("The following cluster definitions: %s") % (",
".join(clusters)))
+ if parents:
+ actions.append(_("The parents of the following hosts: %s") % (",
".join(parents)))
+
# Rules that explicitely name that host (no regexes)
changed_rulesets = []
def rename_host_in_folder_rules(folder):