# HG changeset patch # User Heiko Schlittermann (NIDRA) # Date 1389651049 -3600 # Node ID 0f74bcc68b05cf87759eb7068c2c1472157c8d6c # Parent f5467f4a3e9476e2dcaf60d64e6b5cb31c55b482 check if the ignored filesystems really exist diff -r f5467f4a3e94 -r 0f74bcc68b05 plugins/check_amanda-client --- a/plugins/check_amanda-client Sat Jan 11 23:54:53 2014 +0100 +++ b/plugins/check_amanda-client Mon Jan 13 23:10:49 2014 +0100 @@ -21,7 +21,7 @@ sub get_devices; sub amchecks; -sub amlists; +sub compare_lists; sub main; @@ -81,7 +81,7 @@ eval { amchecks @confs } or critical $@; - my @dles = eval { amlists confs => \@confs, ignore => \@opt_ignore } or critical $@; + my @dles = eval { compare_lists confs => \@confs, ignore => \@opt_ignore } or critical $@; ok 'config: ' . join(', ', @confs), @dles; # never reached @@ -215,13 +215,15 @@ return map { [$_, (stat $_)[1] == 2 ? (stat $_)[0] : -1] } @dles; } -sub amlists { +sub compare_lists { my %arg = @_; my @confs = @{$arg{confs}} or croak 'missing list of confs'; my @ignore = @{$arg{ignore}}; + warning "ignored filesystem(s) @$_ does not exist, update the config please!\n" + if @ignore and @$_ = grep { not -e } unique map { /^.*?:(.*)/ } @ignore; + my @candidates = get_devices; - my %missing; foreach my $conf (@confs) { @@ -239,6 +241,7 @@ die map { "$_ missing: " . join(', ' => @{ $missing{$_} }) . "\n" } keys %missing if %missing; + return map { $_->[0] } @candidates; }