From dc937c473cdaa8366cf5d2c1bbdd74878135f42c Mon Sep 17 00:00:00 2001 From: Matthew Boyle Date: Thu, 12 Nov 2009 18:15:04 +0000 Subject: [PATCH] fix logic in _suggested_links(): + never return any suggested links when the plugin shouldn't be installed. + correctly handle SNMP plugins whose only wildcard parameter is the host. (thanks to janl for spotting this was broken.) --- node/lib/Munin/Node/Configure/Plugin.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/node/lib/Munin/Node/Configure/Plugin.pm b/node/lib/Munin/Node/Configure/Plugin.pm index 7d887fe228..8d5b90eefb 100644 --- a/node/lib/Munin/Node/Configure/Plugin.pm +++ b/node/lib/Munin/Node/Configure/Plugin.pm @@ -130,11 +130,15 @@ sub _installed_links { return (shift)->{installed}; } sub _suggested_links { my ($self) = @_; - if ($self->{default} eq 'yes' and not $self->is_wildcard) { - return [ $self->{name} ]; + + # no suggestions if there isn't any + return [] if $self->{default} ne 'yes'; + + if ($self->is_wildcard or $self->{name} =~ /^snmp__/) { + return [ map { $self->_expand_wildcard($_) } @{$self->{suggestions}} ]; } else { - return [ map { $self->_expand_wildcard($_) } @{$self->{suggestions}} ]; + return [ $self->{name} ]; } }