# HG changeset patch # User heiko # Date 1420647258 -3600 # Node ID e21e904c132041ed8fe44be879714f54cd3cd6b8 # Parent 6d401297850bf1f72b29eb10ab4f0d27adf64900 zones.override automatically added to domainlist If the local: domainlist is used, the domains containted in the override file are added automatically to the list of domains diff -r 6d401297850b -r e21e904c1320 plugins/check_dns-delegation --- a/plugins/check_dns-delegation Wed Jan 07 15:56:05 2015 +0100 +++ b/plugins/check_dns-delegation Wed Jan 07 17:14:18 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 domains are added automatically (See opt B). + =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{local}; 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) }; diff -r 6d401297850b -r e21e904c1320 t/10-minimal.t --- a/t/10-minimal.t Wed Jan 07 15:56:05 2015 +0100 +++ b/t/10-minimal.t Wed Jan 07 17:14:18 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';