fixed the exclusion list
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Sat, 15 Feb 2014 23:13:06 +0100
changeset 45 fe9aec849ab3
parent 44 8d2c3b246651
child 46 a1cab33c4a51
fixed the exclusion list
plugins/check_amanda-client
--- a/plugins/check_amanda-client	Mon Feb 10 14:16:52 2014 +0100
+++ b/plugins/check_amanda-client	Sat Feb 15 23:13:06 2014 +0100
@@ -12,6 +12,7 @@
 use Carp;
 use Pod::Usage;
 use Const::Fast;
+use if $ENV{DEBUG} => 'Smart::Comments';
 
 const my $NAME  => 'AMANDA-CLIENT';
 const my $USER  => 'backup';
@@ -33,7 +34,7 @@
 sub CRITICAL;
 sub UNKNOWN;
 sub verbose;
-sub unique { my %h; @h{@_} = (); keys %h }
+sub unique { my %h; @h{@_} = (); return keys %h }
 
 local $SIG{__DIE__} = sub { UNKNOWN @_ unless $^S };
 
@@ -155,7 +156,7 @@
 				$mode, $group, $f_mode, $f_owner, $f_group;
 
 		if (-f '/etc/debian_version') {
-			$msg .= sprintf  "try dpkg-statoverride --update --add root %s 0%04o %s\n",
+			$msg .= sprintf  "try dpkg-statoverride --update --add root %sgroup 0%04o %s\n",
 			  $group, $mode, $file;
 		}
 
@@ -239,7 +240,11 @@
 sub compare_lists {
     my %arg     = @_;
     my @confs   = @{ $arg{confs} } or croak 'missing list of confs';
-    my @exclude = @{ $arg{exclude} };
+
+    # magic: if there is no config with the exclude, generate a list of config:exclude
+    my @exclude = map { /^[^\/]+?:/ ? $_ : do { my $x = $_; map { "$_:$x" } @confs } }  
+		  @{ $arg{exclude} };
+    ### exclude:@exclude
 
     WARNING
       "excluded filesystem(s) @$_ does not exist, update the config please!\n"
@@ -249,10 +254,14 @@
     my @candidates = get_devices;
     my %missing;
 
+    ### Candidates: @candidates
     foreach my $conf (@confs) {
         my @dles = _amlist $conf;
+	### DLEs: @dles
+
         foreach my $candidate (@candidates) {
-            next if not $candidate =~ m{^/|\Q$conf\E:};
+            ### $candidate
+            #next if not $candidate =~ m{^/|\Q$conf\E:};
 
             # we're satisfied if either the name of the device is in
             # the disklist, or the device id is found