Module: check_mk
Branch: master
Commit: 58f7087984650c19adba1033e7b3d1175827299a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=58f7087984650c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 6 15:08:39 2016 +0200
3369 FIX Printing configuration warning when host references itself as parent
---
.werks/3369 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/wato/builtin_attributes.py | 3 +++
3 files changed, 14 insertions(+)
diff --git a/.werks/3369 b/.werks/3369
new file mode 100644
index 0000000..8c57742
--- /dev/null
+++ b/.werks/3369
@@ -0,0 +1,10 @@
+Title: Printing configuration warning when host references itself as parent
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1459948099
+
+
diff --git a/ChangeLog b/ChangeLog
index 009e0f0..3f2770d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -227,6 +227,7 @@
* 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
* 3366 FIX: Fixed renaming of hosts not updating parents configured in folders
+ * 3369 FIX: Printing configuration warning when host references itself as parent
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/plugins/wato/builtin_attributes.py
b/web/plugins/wato/builtin_attributes.py
index c838488..8e8b4ff 100644
--- a/web/plugins/wato/builtin_attributes.py
+++ b/web/plugins/wato/builtin_attributes.py
@@ -124,6 +124,9 @@ declare_host_attribute(ParentsAttribute(),
def validate_host_parents(host):
for parent_name in host.parents():
+ if parent_name == host.name():
+ raise MKUserError(None, _("You configured the host to be it's own
parent, which is not allowed."))
+
parent = Host.host(parent_name)
if not parent:
raise MKUserError(None, _("You defined the non-existing host
'%s' as a parent.") % parent_name)