From 7944b8ccc38bebf1721ebb826356b2b76c3abacc Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 7 Oct 2013 21:03:58 +0100 Subject: [PATCH] nodenames instead of nodeip2name --- Netdisco/lib/App/Netdisco/Daemon/Queue.pm | 2 +- .../lib/App/Netdisco/Daemon/Worker/Manager.pm | 2 +- .../App/Netdisco/Daemon/Worker/Poller/Arpnip.pm | 16 ++++++++-------- Netdisco/lib/App/Netdisco/Util/Device.pm | 16 ++++++++-------- Netdisco/share/config.yml | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Netdisco/lib/App/Netdisco/Daemon/Queue.pm b/Netdisco/lib/App/Netdisco/Daemon/Queue.pm index 5988287d..336f65a4 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Queue.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Queue.pm @@ -22,7 +22,7 @@ sub capacity_for { debug "checking local capacity for action $action"; 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/], }; diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm index ab7c733b..0087d149 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm @@ -13,7 +13,7 @@ my $fqdn = hostfqdn || 'localhost'; my $role_map = { (map {$_ => 'Poller'} - qw/discoverall discover arpwalk arpnip nodeip2name macwalk macsuck/), + qw/discoverall discover arpwalk arpnip nodenames macwalk macsuck/), (map {$_ => 'Interactive'} qw/location contact portcontrol portname vlan power/) }; diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller/Arpnip.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller/Arpnip.pm index 132a1b89..854d91e2 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller/Arpnip.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller/Arpnip.pm @@ -3,7 +3,7 @@ package App::Netdisco::Daemon::Worker::Poller::Arpnip; use Dancer::Plugin::DBIC 'schema'; 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::Daemon::Util ':all'; @@ -33,7 +33,7 @@ after 'arpnip' => sub { schema('netdisco')->txn_do(sub { $jobqueue->create({ device => $device->ip, - action => 'nodeip2name', + action => 'nodenames', status => 'queued', username => $job->username, userip => $job->userip, @@ -41,8 +41,8 @@ after 'arpnip' => sub { }); }; -# run a nodeip2name job for one device -sub nodeip2name { +# run a nodenames job for one device +sub nodenames { my ($self, $job) = @_; my $host = NetAddr::IP::Lite->new($job->device); @@ -50,16 +50,16 @@ sub nodeip2name { my $jobqueue = schema('netdisco')->resultset('Admin'); 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)) { - return job_defer("nodeip2name deferred: $host is not nodeip2nameable"); + unless (can_nodenames($device->ip)) { + return job_defer("nodenames deferred: $host is not nodenames"); } resolve_node_names($device); - return job_done("Ended nodeip2name for ". $host->addr); + return job_done("Ended nodenames for ". $host->addr); } 1; diff --git a/Netdisco/lib/App/Netdisco/Util/Device.pm b/Netdisco/lib/App/Netdisco/Util/Device.pm index 7ba42508..b3d01b65 100644 --- a/Netdisco/lib/App/Netdisco/Util/Device.pm +++ b/Netdisco/lib/App/Netdisco/Util/Device.pm @@ -12,7 +12,7 @@ our @EXPORT_OK = qw/ check_no is_discoverable is_arpnipable - is_nodeip2nameable + can_nodenames is_macsuckable /; our %EXPORT_TAGS = (all => \@EXPORT_OK); @@ -196,12 +196,12 @@ sub is_arpnipable { return 1; } -=head2 is_nodeip2nameable( $ip ) +=head2 can_nodenames( $ip ) Given an IP address, returns C 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 and C are checked +The configuration items C and C are checked against the given IP. Returns false if the host is not permitted to do this job for the target @@ -209,15 +209,15 @@ device. =cut -sub is_nodeip2nameable { +sub can_nodenames { my $ip = shift; my $device = get_device($ip) or return 0; - return _bail_msg("is_nodeip2nameable: device matched nodeip2name_no") - if check_no($device, 'nodeip2name_no'); + return _bail_msg("can_nodenames device matched nodenames_no") + if check_no($device, 'nodenames_no'); - return _bail_msg("is_nodeip2nameable: device failed to match nodeip2name_only") - if check_no($device, 'nodeip2name_only'); + return _bail_msg("can_nodenames: device failed to match nodenames_only") + if check_no($device, 'nodenames_only'); return 1; } diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index bddcea0d..f8a366e8 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -86,8 +86,8 @@ macsuck_min_age: 0 arpnip_no: [] arpnip_only: [] arpnip_min_age: 0 -nodeip2name_no: [] -nodeip2name_only: [] +nodenames_no: [] +nodenames_only: [] store_wireless_clients: true store_modules: true ignore_interfaces: