From 88e6b96a77061498a7ca7d583f9da5b02c63844b Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sat, 15 Dec 2018 04:38:24 +0100 Subject: [PATCH] Remove "ignore" value for "use_node_name" The additional value "ignore" was added in dd4cbb501ca7152. It caused the following "list" commands to be sent to the node: * "yes" -> "list $self->{node_name}" * "ignore" -> "list " * "no" -> "list $self->{host}" * any other value -> "list $self->{host}" The above "$self->{node_name}" is the name advertised by the node during the opening of the connection. "$self->{host}" is the name of the node section in the master configuration. The new behaviour is the following: * "yes" -> "list" * "ignore" -> "list" * "no" -> "list $self->{host}" * any other value -> "list $self->{host}" This behaviour has the same effect as before, as the request for "list" (without a specific node name) is handley by munin-node exactly, as if its "node_name" is supplied. --- lib/Munin/Master/Node.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/Munin/Master/Node.pm b/lib/Munin/Master/Node.pm index 44d1c11058..6b8a8ff8a7 100644 --- a/lib/Munin/Master/Node.pm +++ b/lib/Munin/Master/Node.pm @@ -255,16 +255,24 @@ sub list_plugins { my $use_node_name = defined($self->{configref}{use_node_name}) ? $self->{configref}{use_node_name} : $config->{use_node_name}; - my $host = Munin::Master::Config->_parse_bool($use_node_name, 0) - ? $self->{node_name} - : $self->{host}; - my $host_list = ($use_node_name && $use_node_name eq "ignore") ? "" : $host; - $self->_node_write_single("list $host_list\n"); + # "use_node_name" was allowed to be "ignore" for some time. This usage is discouraged and + # treated as "yes", since the effect of "ignore" and "yes" did not differ. + $use_node_name = "yes" if ($use_node_name eq "ignore"); + + my $list_request_description; + if (Munin::Master::Config->_parse_bool($use_node_name, 0)) { + $self->_node_write_single("list\n"); + $list_request_description = "local services"; + } else { + $self->_node_write_single("list $self->{host}\n"); + $list_request_description = "services for '$self->{host}'"; + } + my $list = $self->_node_read_single(); if (not $list) { - WARN "[WARNING] Config node $self->{host} listed no services for '$host_list'. Please see http://munin-monitoring.org/wiki/FAQ_no_graphs for further information."; + WARN "[WARNING] Config node $self->{host} listed no $list_request_description. Please see http://munin-monitoring.org/wiki/FAQ_no_graphs for further information."; } return split / /, $list;