Node DNS names resolved in their own job

This commit is contained in:
Oliver Gorwits
2013-10-07 21:44:40 +01:00
parent e367805e51
commit 1deba8f90c
9 changed files with 146 additions and 14 deletions

View File

@@ -12,6 +12,7 @@ our @EXPORT_OK = qw/
check_no
is_discoverable
is_arpnipable
can_nodenames
is_macsuckable
/;
our %EXPORT_TAGS = (all => \@EXPORT_OK);
@@ -195,6 +196,32 @@ sub is_arpnipable {
return 1;
}
=head2 can_nodenames( $ip )
Given an IP address, returns C<true> if Netdisco on this host is permitted by
the local configuration to resolve Node IPs to DNS names for the device.
The configuration items C<nodenames_no> and C<nodenames_only> are checked
against the given IP.
Returns false if the host is not permitted to do this job for the target
device.
=cut
sub can_nodenames {
my $ip = shift;
my $device = get_device($ip) or return 0;
return _bail_msg("can_nodenames device matched nodenames_no")
if check_no($device, 'nodenames_no');
return _bail_msg("can_nodenames: device failed to match nodenames_only")
if check_no($device, 'nodenames_only');
return 1;
}
=head2 is_macsuckable( $ip )
Given an IP address, returns C<true> if Netdisco on this host is permitted by