Module: check_mk
Branch: master
Commit: 6df0bf66a96ae325e450cf56a3e8c975af94e1e2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6df0bf66a96ae3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 27 17:08:07 2015 +0100
Fix exception in activate changes when clusters are defined
---
modules/check_mk.py | 21 +++++++++++++++++++++
modules/nagios.py | 22 ----------------------
2 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 386aa7b..8402777 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1436,6 +1436,27 @@ def get_cluster_attributes(hostname, nodes):
return attrs
+def verify_cluster_address_family(hostname):
+ cluster_host_family = is_ipv6_primary(hostname) and "IPv6" or
"IPv4"
+
+ address_families = [
+ "%s: %s" % (hostname, cluster_host_family),
+ ]
+
+ address_family = cluster_host_family
+ mixed = False
+ for nodename in nodes_of(hostname):
+ family = is_ipv6_primary(nodename) and "IPv6" or "IPv4"
+ address_families.append("%s: %s" % (nodename, family))
+ if address_family == None:
+ address_family = family
+ elif address_family != family:
+ mixed = True
+
+ if mixed:
+ raise MKGeneralException("Cluster '%s' has different primary address
families: %s" %
+ (hostname, ",
".join(address_families)))
+
def ip_address_of(hostname, family=None):
try:
return lookup_ip_address(hostname, family)
diff --git a/modules/nagios.py b/modules/nagios.py
index ba9e488..f369af0 100644
--- a/modules/nagios.py
+++ b/modules/nagios.py
@@ -673,28 +673,6 @@ define service {
""" % (pingonly_template, descr, ping_command, arguments,
extra_service_conf_of(hostname, descr), hostname))
-def verify_cluster_address_family(hostname):
- cluster_host_family = is_ipv6_primary(hostname) and "IPv6" or
"IPv4"
-
- address_families = [
- "%s: %s" % (hostname, cluster_host_family),
- ]
-
- address_family = cluster_host_family
- mixed = False
- for nodename in nodes_of(hostname):
- family = is_ipv6_primary(nodename) and "IPv6" or "IPv4"
- address_families.append("%s: %s" % (nodename, family))
- if address_family == None:
- address_family = family
- elif address_family != family:
- mixed = True
-
- if mixed:
- raise MKGeneralException("Cluster '%s' has different primary address
families: %s" %
- (hostname, ",
".join(address_families)))
-
-
def autodetect_plugin(command_line):
plugin_name = command_line.split()[0]
if command_line[0] not in [ '$', '/' ]: