Squashed commit of the following: commit975e4c6afcAuthor: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 13:35:26 2019 +0100 also support regexp in domain_suffix commit0a2b5c8fa2Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 13:17:17 2019 +0100 fix rancid, graph, and nodemonitor commit6d881de3ffAuthor: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 13:11:54 2019 +0100 improve docs and set default domain_suffix to be list commit1dcafc08a8Merge:9a752e0214ac69dcAuthor: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 13:00:39 2019 +0100 Merge branch 'master' into og-multiple-domain-suffix commit9a752e0298Merge:c836619f82a99ea9Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Sep 3 09:45:25 2019 +0100 Merge branch 'master' into og-multiple-domain-suffix commitc836619f8cAuthor: Oliver Gorwits <oliver@cpan.org> Date: Thu Jun 13 07:52:45 2019 +0100 hokey fix for nodes with domains commitfed14bd810Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Jun 13 07:02:09 2019 +0100 basic implementation, rancid graph and nodemonitor missing
42 lines
1.1 KiB
Perl
42 lines
1.1 KiB
Perl
package App::Netdisco::Web::Plugin::Report::DeviceDnsMismatch;
|
|
|
|
use Dancer ':syntax';
|
|
use Dancer::Plugin::DBIC;
|
|
use Dancer::Plugin::Auth::Extensible;
|
|
|
|
use App::Netdisco::Web::Plugin;
|
|
|
|
register_report(
|
|
{ category => 'Device',
|
|
tag => 'devicednsmismatch',
|
|
label => 'Device Name / DNS Mismatches',
|
|
provides_csv => 1,
|
|
}
|
|
);
|
|
|
|
get '/ajax/content/report/devicednsmismatch' => require_login sub {
|
|
|
|
my $suffix = setting('domain_suffix');
|
|
|
|
my @results
|
|
= schema('netdisco')->resultset('Virtual::DeviceDnsMismatch')
|
|
->search( undef, { bind => [ $suffix, $suffix ] } )
|
|
->columns( [qw/ ip dns name location contact /] )->hri->all;
|
|
|
|
return unless scalar @results;
|
|
|
|
if ( request->is_ajax ) {
|
|
my $json = to_json( \@results );
|
|
template 'ajax/report/devicednsmismatch.tt', { results => $json },
|
|
{ layout => undef };
|
|
}
|
|
else {
|
|
header( 'Content-Type' => 'text/comma-separated-values' );
|
|
template 'ajax/report/devicednsmismatch_csv.tt',
|
|
{ results => \@results },
|
|
{ layout => undef };
|
|
}
|
|
};
|
|
|
|
1;
|