Include the override domains into local:
If local: is selected as source of domain names, the override file will
be used as an additional source too.
--- a/plugins/check_dns-delegation Wed Jan 07 15:56:05 2015 +0100
+++ b/plugins/check_dns-delegation Wed Jan 07 16:34:53 2015 +0100
@@ -47,6 +47,8 @@
master/slave zones. The 127.in-addr.arpa, 168.192.in-addr.arpa, and
0.in-addr.arpa, and 127.in-addr.arpa zones are suppressed.
+The B<override> domains are added automatically (See opt B<override>).
+
=back
=cut
@@ -100,7 +102,8 @@
}
sub get_domains {
- my @sources = @_;
+ my %arg = @_;
+ my @sources = @{ $arg{sources} };
my @domains = ();
foreach my $src (@sources) {
@@ -113,6 +116,7 @@
if ($src =~ m{^local:}) {
push @domains, get_local_zones;
+ push @domains, @{$arg{local}} if $arg{override};
next;
}
@@ -235,11 +239,11 @@
)
and @argv
or pod2usage;
- my @domains = get_domains(@argv);
my %override = read_override($opt_override) if defined $opt_override;
+ my @domains = get_domains(sources => \@argv, local => [keys %override]);
my (@OK, %CRITICAL);
- foreach my $domain (shuffle @domains, keys %override) {
+ foreach my $domain (shuffle @domains) {
print STDERR "$domain " if $opt_progress;
my @ns = eval { ns_ok($domain, $opt_reference, \%override) };
--- a/t/10-minimal.t Wed Jan 07 15:56:05 2015 +0100
+++ b/t/10-minimal.t Wed Jan 07 16:34:53 2015 +0100
@@ -34,10 +34,9 @@
# get_domains should read a list of names, either from a file
# or from the arguments, or from a combination of both
- is_deeply [get_domains(qw(a b c))], [qw(a b c)] => 'domains from list';
- is_deeply [get_domains("$tmp")], [qw(a b c d)] => 'domains from file';
- is_deeply [get_domains('a', "$tmp", 'z')],
- [qw(a a b c d z)] => 'domains from args and file';
+ is_deeply [get_domains(sources => [qw/a b c/])], [qw(a b c)] => 'domains from list';
+ is_deeply [get_domains(sources => ["$tmp"])], [qw(a b c d)] => 'domains from file';
+ is_deeply [get_domains(sources => ['a', "$tmp", 'z'])], [qw(a a b c d z)] => 'domains from args and file';
is_deeply {read_override("$tmp")}, { c => ['ns1', 'ns2'] }, 'override file';