Module: check_mk
Branch: master
Commit: b4449e4a176588e173d5d154730b00a83c7aa922
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b4449e4a176588…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 21 08:33:30 2017 +0100
4509 FIX Removed now useless "parents" attribute from "New/Edit cluster
dialog"
Since the parents of cluster hosts are automatically determined in all situations now,
we have removed this attribute from the GUI.
Change-Id: Ie8d1edb007767aee109dcdfcc6c7c8f4725df00e
---
.bugs/2330 | 6 +++++-
.werks/4509 | 12 ++++++++++++
web/htdocs/wato.py | 24 +++++++++++++-----------
web/plugins/wato/builtin_attributes.py | 3 +++
4 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/.bugs/2330 b/.bugs/2330
index e80a420..965484b 100644
--- a/.bugs/2330
+++ b/.bugs/2330
@@ -1,6 +1,7 @@
Title: Cluster should always have only it's nodes as parents
Component: core
-State: open
+Class: bug
+State: done
Date: 2016-02-16 13:42:50
Targetversion: 1.4.0
Class: bug
@@ -25,3 +26,6 @@ Das erwartete Ergebnis kann aktuell erreicht werden, in dem für das
Cluster Par
----------------------------
Is this really correct for all kind of clusters (with, without IP, ...)?
+
+2017-03-21 08:23:02: changed state open -> done
+Has been fixed for 1.4.0 and master.
diff --git a/.werks/4509 b/.werks/4509
new file mode 100644
index 0000000..d552d59
--- /dev/null
+++ b/.werks/4509
@@ -0,0 +1,12 @@
+Title: Removed now useless "parents" attribute from "New/Edit cluster
dialog"
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1490081502
+
+Since the parents of cluster hosts are automatically determined in all situations now,
+we have removed this attribute from the GUI.
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 29073ad..9d916d7 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1381,7 +1381,8 @@ def mode_edit_host(phase, new, is_cluster):
html.help(_('Enter the host names of the cluster nodes. These '
'hosts must be present in WATO. '))
- configure_attributes(new, {hostname: host}, "host", parent =
Folder.current())
+ configure_attributes(new, {hostname: host}, "host" if not is_cluster else
"cluster",
+ parent = Folder.current())
forms.end()
if not Folder.current().locked_hosts():
@@ -16756,10 +16757,11 @@ class UserIconOrAction(DropdownChoice):
#
# new: Boolean flag if this is a creation step or editing
# for_what can be:
-# "host" -> normal host edit dialog
-# "folder" -> properties of folder or file
+# "host" -> normal host edit dialog
+# "cluster" -> normal host edit dialog
+# "folder" -> properties of folder or file
# "host_search" -> host search dialog
-# "bulk" -> bulk change
+# "bulk" -> bulk change
# parent: The parent folder of the objects to configure
# myself: For mode "folder" the folder itself or None, if we edit a new folder
# This is needed for handling mandatory attributes.
@@ -16816,7 +16818,7 @@ def configure_attributes(new, hosts, for_what, parent,
myself=None, without_attr
depends_on_roles = attr.depends_on_roles()
# Add host tag dependencies, but only in host mode. In other
# modes we always need to show all attributes.
- if for_what == "host" and depends_on_tags:
+ if for_what in [ "host", "cluster" ] and
depends_on_tags:
dependency_mapping_tags[attrname] = depends_on_tags
if depends_on_roles:
@@ -16842,7 +16844,7 @@ def configure_attributes(new, hosts, for_what, parent,
myself=None, without_attr
# one and have the same value
unique = num_haveit == 0 or (len(values) == 1 and num_haveit == len(hosts))
- if for_what in [ "host", "folder" ]:
+ if for_what in [ "host", "cluster", "folder"
]:
host = hosts.values()[0]
# Collect information about attribute values inherited from folder.
@@ -16854,7 +16856,7 @@ def configure_attributes(new, hosts, for_what, parent,
myself=None, without_attr
container = None
if attr.show_inherited_value():
- if for_what == "host":
+ if for_what in [ "host", "cluster" ]:
url = Folder.current().edit_url()
container = parent # container is of type Folder
@@ -16906,7 +16908,7 @@ def configure_attributes(new, hosts, for_what, parent,
myself=None, without_attr
and not has_inherited:
force_entry = True
active = True
- elif for_what == "host" and attr.is_mandatory() and not
has_inherited:
+ elif for_what in [ "host", "cluster" ] and
attr.is_mandatory() and not has_inherited:
force_entry = True
active = True
elif cb != None:
@@ -16915,7 +16917,7 @@ def configure_attributes(new, hosts, for_what, parent,
myself=None, without_attr
active = unique and len(values) > 0
elif for_what == "folder" and myself:
active = myself.has_explicit_attribute(attrname)
- elif for_what == "host" and host: # "host"
+ elif for_what in [ "host", "cluster" ] and host: #
"host"
active = host.has_explicit_attribute(attrname)
else:
active = False
@@ -16926,7 +16928,7 @@ def configure_attributes(new, hosts, for_what, parent,
myself=None, without_attr
else:
disabled = True
- if (for_what == "host" and parent.locked_hosts()) or (for_what ==
"folder" and myself and myself.locked()):
+ if (for_what in [ "host", "cluster" ] and
parent.locked_hosts()) or (for_what == "folder" and myself and
myself.locked()):
checkbox_code = None
elif force_entry:
checkbox_code = html.render_checkbox("ignored_" +
checkbox_name, add_attr=["disabled"])
@@ -16980,7 +16982,7 @@ def configure_attributes(new, hosts, for_what, parent,
myself=None, without_attr
else:
value = values[0]
- elif for_what in [ "host", "folder" ]:
+ elif for_what in [ "host", "cluster", "folder"
]:
if not new and (not attr.editable() or not attr.may_edit()) and active:
value = values[0]
else:
diff --git a/web/plugins/wato/builtin_attributes.py
b/web/plugins/wato/builtin_attributes.py
index 360c981..f18638a 100644
--- a/web/plugins/wato/builtin_attributes.py
+++ b/web/plugins/wato/builtin_attributes.py
@@ -209,6 +209,9 @@ class ParentsAttribute(ValueSpecAttribute):
"of its parents are monitored by the same site."),
orientation = "horizontal"))
+ def is_visible(self, for_what):
+ return for_what != "cluster"
+
def to_nagios(self, value):
if value:
return ",".join(value)