nodenames instead of nodeip2name
This commit is contained in:
@@ -22,7 +22,7 @@ sub capacity_for {
|
|||||||
debug "checking local capacity for action $action";
|
debug "checking local capacity for action $action";
|
||||||
|
|
||||||
my $action_map = {
|
my $action_map = {
|
||||||
Poller => [qw/discoverall discover arpwalk arpnip nodeip2name macwalk macsuck/],
|
Poller => [qw/discoverall discover arpwalk arpnip nodenames macwalk macsuck/],
|
||||||
Interactive => [qw/location contact portcontrol portname vlan power/],
|
Interactive => [qw/location contact portcontrol portname vlan power/],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ my $fqdn = hostfqdn || 'localhost';
|
|||||||
|
|
||||||
my $role_map = {
|
my $role_map = {
|
||||||
(map {$_ => 'Poller'}
|
(map {$_ => 'Poller'}
|
||||||
qw/discoverall discover arpwalk arpnip nodeip2name macwalk macsuck/),
|
qw/discoverall discover arpwalk arpnip nodenames macwalk macsuck/),
|
||||||
(map {$_ => 'Interactive'}
|
(map {$_ => 'Interactive'}
|
||||||
qw/location contact portcontrol portname vlan power/)
|
qw/location contact portcontrol portname vlan power/)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package App::Netdisco::Daemon::Worker::Poller::Arpnip;
|
|||||||
use Dancer::Plugin::DBIC 'schema';
|
use Dancer::Plugin::DBIC 'schema';
|
||||||
|
|
||||||
use App::Netdisco::Core::Arpnip 'do_arpnip';
|
use App::Netdisco::Core::Arpnip 'do_arpnip';
|
||||||
use App::Netdisco::Util::Device qw/get_device is_arpnipable is_nodeip2nameable/;
|
use App::Netdisco::Util::Device qw/get_device is_arpnipable can_nodenames/;
|
||||||
|
|
||||||
use App::Netdisco::Core::Arpnip 'resolve_node_names';
|
use App::Netdisco::Core::Arpnip 'resolve_node_names';
|
||||||
use App::Netdisco::Daemon::Util ':all';
|
use App::Netdisco::Daemon::Util ':all';
|
||||||
@@ -33,7 +33,7 @@ after 'arpnip' => sub {
|
|||||||
schema('netdisco')->txn_do(sub {
|
schema('netdisco')->txn_do(sub {
|
||||||
$jobqueue->create({
|
$jobqueue->create({
|
||||||
device => $device->ip,
|
device => $device->ip,
|
||||||
action => 'nodeip2name',
|
action => 'nodenames',
|
||||||
status => 'queued',
|
status => 'queued',
|
||||||
username => $job->username,
|
username => $job->username,
|
||||||
userip => $job->userip,
|
userip => $job->userip,
|
||||||
@@ -41,8 +41,8 @@ after 'arpnip' => sub {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
# run a nodeip2name job for one device
|
# run a nodenames job for one device
|
||||||
sub nodeip2name {
|
sub nodenames {
|
||||||
my ($self, $job) = @_;
|
my ($self, $job) = @_;
|
||||||
|
|
||||||
my $host = NetAddr::IP::Lite->new($job->device);
|
my $host = NetAddr::IP::Lite->new($job->device);
|
||||||
@@ -50,16 +50,16 @@ sub nodeip2name {
|
|||||||
my $jobqueue = schema('netdisco')->resultset('Admin');
|
my $jobqueue = schema('netdisco')->resultset('Admin');
|
||||||
|
|
||||||
if ($device->ip eq '0.0.0.0') {
|
if ($device->ip eq '0.0.0.0') {
|
||||||
return job_error("nodeip2name failed: no device param (need -d ?)");
|
return job_error("nodenames failed: no device param (need -d ?)");
|
||||||
}
|
}
|
||||||
|
|
||||||
unless (is_nodeip2nameable($device->ip)) {
|
unless (can_nodenames($device->ip)) {
|
||||||
return job_defer("nodeip2name deferred: $host is not nodeip2nameable");
|
return job_defer("nodenames deferred: $host is not nodenames");
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_node_names($device);
|
resolve_node_names($device);
|
||||||
|
|
||||||
return job_done("Ended nodeip2name for ". $host->addr);
|
return job_done("Ended nodenames for ". $host->addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ our @EXPORT_OK = qw/
|
|||||||
check_no
|
check_no
|
||||||
is_discoverable
|
is_discoverable
|
||||||
is_arpnipable
|
is_arpnipable
|
||||||
is_nodeip2nameable
|
can_nodenames
|
||||||
is_macsuckable
|
is_macsuckable
|
||||||
/;
|
/;
|
||||||
our %EXPORT_TAGS = (all => \@EXPORT_OK);
|
our %EXPORT_TAGS = (all => \@EXPORT_OK);
|
||||||
@@ -196,12 +196,12 @@ sub is_arpnipable {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
=head2 is_nodeip2nameable( $ip )
|
=head2 can_nodenames( $ip )
|
||||||
|
|
||||||
Given an IP address, returns C<true> if Netdisco on this host is permitted by
|
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 local configuration to resolve Node IPs to DNS names for the device.
|
||||||
|
|
||||||
The configuration items C<nodeip2name_no> and C<nodeip2name_only> are checked
|
The configuration items C<nodenames_no> and C<nodenames_only> are checked
|
||||||
against the given IP.
|
against the given IP.
|
||||||
|
|
||||||
Returns false if the host is not permitted to do this job for the target
|
Returns false if the host is not permitted to do this job for the target
|
||||||
@@ -209,15 +209,15 @@ device.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub is_nodeip2nameable {
|
sub can_nodenames {
|
||||||
my $ip = shift;
|
my $ip = shift;
|
||||||
my $device = get_device($ip) or return 0;
|
my $device = get_device($ip) or return 0;
|
||||||
|
|
||||||
return _bail_msg("is_nodeip2nameable: device matched nodeip2name_no")
|
return _bail_msg("can_nodenames device matched nodenames_no")
|
||||||
if check_no($device, 'nodeip2name_no');
|
if check_no($device, 'nodenames_no');
|
||||||
|
|
||||||
return _bail_msg("is_nodeip2nameable: device failed to match nodeip2name_only")
|
return _bail_msg("can_nodenames: device failed to match nodenames_only")
|
||||||
if check_no($device, 'nodeip2name_only');
|
if check_no($device, 'nodenames_only');
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ macsuck_min_age: 0
|
|||||||
arpnip_no: []
|
arpnip_no: []
|
||||||
arpnip_only: []
|
arpnip_only: []
|
||||||
arpnip_min_age: 0
|
arpnip_min_age: 0
|
||||||
nodeip2name_no: []
|
nodenames_no: []
|
||||||
nodeip2name_only: []
|
nodenames_only: []
|
||||||
store_wireless_clients: true
|
store_wireless_clients: true
|
||||||
store_modules: true
|
store_modules: true
|
||||||
ignore_interfaces:
|
ignore_interfaces:
|
||||||
|
|||||||
Reference in New Issue
Block a user