equal
deleted
inserted
replaced
79 my @confs = sort +unique eval { config_names $CFDIR } |
79 my @confs = sort +unique eval { config_names $CFDIR } |
80 or unknown $@; |
80 or unknown $@; |
81 |
81 |
82 eval { amchecks @confs } or critical $@; |
82 eval { amchecks @confs } or critical $@; |
83 |
83 |
84 my @dles = eval { compare_lists confs => \@confs, ignore => \@opt_ignore } or critical $@; |
84 my @dles = eval { compare_lists confs => \@confs, ignore => \@opt_ignore } |
|
85 or critical $@; |
85 ok 'config: ' . join(', ', @confs), @dles; |
86 ok 'config: ' . join(', ', @confs), @dles; |
86 |
87 |
87 # never reached |
88 # never reached |
88 return 0; |
89 return 0; |
89 } |
90 } |
214 chomp((undef, my @dles) = qx(amdump_client --config '$conf' list)); |
215 chomp((undef, my @dles) = qx(amdump_client --config '$conf' list)); |
215 return map { [$_, (stat $_)[1] == 2 ? (stat $_)[0] : -1] } @dles; |
216 return map { [$_, (stat $_)[1] == 2 ? (stat $_)[0] : -1] } @dles; |
216 } |
217 } |
217 |
218 |
218 sub compare_lists { |
219 sub compare_lists { |
219 my %arg = @_; |
220 my %arg = @_; |
220 my @confs = @{$arg{confs}} or croak 'missing list of confs'; |
221 my @confs = @{ $arg{confs} } or croak 'missing list of confs'; |
221 my @ignore = @{$arg{ignore}}; |
222 my @ignore = @{ $arg{ignore} }; |
222 |
223 |
223 warning "ignored filesystem(s) @$_ does not exist, update the config please!\n" |
224 warning |
224 if @ignore and @$_ = grep { not -e } unique map { /^.*?:(.*)/ } @ignore; |
225 "ignored filesystem(s) @$_ does not exist, update the config please!\n" |
|
226 if @ignore and @$_ = grep { not -e } unique map { /^.*?:(.*)/ } @ignore; |
225 |
227 |
226 my @candidates = get_devices; |
228 my @candidates = get_devices; |
227 my %missing; |
229 my %missing; |
228 |
230 |
229 foreach my $conf (@confs) { |
231 foreach my $conf (@confs) { |
233 # we're satisfied if either the name of the device is in |
235 # we're satisfied if either the name of the device is in |
234 # the disklist, or the device id is found |
236 # the disklist, or the device id is found |
235 $candidate->[0] ~~ [map { $_->[0] } @dles] and next; |
237 $candidate->[0] ~~ [map { $_->[0] } @dles] and next; |
236 $candidate->[1] ~~ [map { $_->[1] } @dles] and next; |
238 $candidate->[1] ~~ [map { $_->[1] } @dles] and next; |
237 push @{ $missing{$conf} }, $candidate->[0] |
239 push @{ $missing{$conf} }, $candidate->[0] |
238 if not "$conf:$candidate->[0]" ~~ @ignore; |
240 if not "$conf:$candidate->[0]" ~~ @ignore; |
239 } |
241 } |
240 } |
242 } |
241 die map { "$_ missing: " . join(', ' => @{ $missing{$_} }) . "\n" } |
243 die map { "$_ missing: " . join(', ' => @{ $missing{$_} }) . "\n" } |
242 keys %missing |
244 keys %missing |
243 if %missing; |
245 if %missing; |