Module: check_mk
Branch: master
Commit: 004c970e71ec1a48a6dd4e38e27786168c38cca4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=004c970e71ec1a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 6 11:58:30 2016 +0200
3365 FIX Cleaned up wrong counting of parents when renaming a host
---
.werks/3365 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 11 +++++++----
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.werks/3365 b/.werks/3365
new file mode 100644
index 0000000..25774ec
--- /dev/null
+++ b/.werks/3365
@@ -0,0 +1,10 @@
+Title: Cleaned up wrong counting of parents when renaming a host
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1459936688
+
+
diff --git a/ChangeLog b/ChangeLog
index 89f2fe3..da3035b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -221,6 +221,7 @@
* 3363 FIX: Exceptions in WATO Web-API are now rendered as plain text messages
* 3324 FIX: Do not crash whole catalog of check plugins if one man page is broken
* 3325 FIX: WATO CSV import: fix missing first line in preview after user error
+ * 3365 FIX: Cleaned up wrong counting of parents when renaming a host
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 3aef798..20e4c24 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1739,6 +1739,11 @@ def rename_host_as_cluster_node(all_hosts, oldname, newname):
return []
+def rename_host_in_parents(oldname, newname):
+ parents = rename_host_as_parent(oldname, newname)
+ return [ "parents" ] * len(parents)
+
+
def rename_host_as_parent(oldname, newname, in_folder=None):
if in_folder == None:
in_folder = Folder.root_folder()
@@ -1753,9 +1758,6 @@ def rename_host_as_parent(oldname, newname, in_folder=None):
if in_folder.rename_parent(oldname, newname):
parents.append(in_folder.name())
- if parents:
- parents = [ "parents" ] * len(parents)
-
for subfolder in in_folder.subfolders().values():
parents += rename_host_as_parent(oldname, newname, subfolder)
@@ -1937,7 +1939,7 @@ def rename_hosts(renamings):
this_host_actions = []
this_host_actions += rename_host_in_folder(folder, oldname, newname)
this_host_actions += rename_host_as_cluster_node(all_hosts, oldname,
newname)
- this_host_actions += rename_host_as_parent(oldname, newname)
+ this_host_actions += rename_host_in_parents(oldname, newname)
this_host_actions += rename_host_in_rulesets(folder, oldname, newname)
this_host_actions += rename_host_in_bi(oldname, newname)
actions += this_host_actions
@@ -2003,6 +2005,7 @@ def render_renaming_actions(action_counts):
"Please update your DNS or configure an IP address
for the affected host.") % what.split("-", 1)[1]
else:
text = action_titles.get(what, what)
+
if count > 1:
text += _(" (%d times)" % count)
texts.append(text)