Merge branch 'master' of github.com:netdisco/netdisco
This commit is contained in:
2
Changes
2
Changes
@@ -1,4 +1,4 @@
|
|||||||
2.035999_003 - 2017-05-29
|
2.036000 - TESTING
|
||||||
|
|
||||||
[NEW FEATURES]
|
[NEW FEATURES]
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
"Sereal" : "0",
|
"Sereal" : "0",
|
||||||
"Socket6" : "0.23",
|
"Socket6" : "0.23",
|
||||||
"Starman" : "0.4008",
|
"Starman" : "0.4008",
|
||||||
|
"Sys::Proctitle" : "0",
|
||||||
"Template" : "2.24",
|
"Template" : "2.24",
|
||||||
"Template::Plugin::CSV" : "0.04",
|
"Template::Plugin::CSV" : "0.04",
|
||||||
"Template::Plugin::Number::Format" : "1.02",
|
"Template::Plugin::Number::Format" : "1.02",
|
||||||
@@ -99,7 +100,7 @@
|
|||||||
"provides" : {
|
"provides" : {
|
||||||
"App::Netdisco" : {
|
"App::Netdisco" : {
|
||||||
"file" : "lib/App/Netdisco.pm",
|
"file" : "lib/App/Netdisco.pm",
|
||||||
"version" : "2.035999_003"
|
"version" : "2.035999_006"
|
||||||
},
|
},
|
||||||
"App::Netdisco::AnyEvent::Nbtstat" : {
|
"App::Netdisco::AnyEvent::Nbtstat" : {
|
||||||
"file" : "lib/App/Netdisco/AnyEvent/Nbtstat.pm"
|
"file" : "lib/App/Netdisco/AnyEvent/Nbtstat.pm"
|
||||||
@@ -649,6 +650,6 @@
|
|||||||
"x_IRC" : "irc://irc.freenode.org/#netdisco",
|
"x_IRC" : "irc://irc.freenode.org/#netdisco",
|
||||||
"x_MailingList" : "https://lists.sourceforge.net/lists/listinfo/netdisco-users"
|
"x_MailingList" : "https://lists.sourceforge.net/lists/listinfo/netdisco-users"
|
||||||
},
|
},
|
||||||
"version" : "2.035999_003",
|
"version" : "2.035999_006",
|
||||||
"x_serialization_backend" : "JSON::PP version 2.27400"
|
"x_serialization_backend" : "JSON::PP version 2.27300"
|
||||||
}
|
}
|
||||||
|
|||||||
9
META.yml
9
META.yml
@@ -9,7 +9,7 @@ configure_requires:
|
|||||||
DBIx::Class: '0.082810'
|
DBIx::Class: '0.082810'
|
||||||
Module::Build: '0.42'
|
Module::Build: '0.42'
|
||||||
dynamic_config: 1
|
dynamic_config: 1
|
||||||
generated_by: 'Module::Build version 0.4222, CPAN::Meta::Converter version 2.150010'
|
generated_by: 'Module::Build version 0.4222, CPAN::Meta::Converter version 2.150005'
|
||||||
license: bsd
|
license: bsd
|
||||||
meta-spec:
|
meta-spec:
|
||||||
url: http://module-build.sourceforge.net/META-spec-v1.4.html
|
url: http://module-build.sourceforge.net/META-spec-v1.4.html
|
||||||
@@ -18,7 +18,7 @@ name: App-Netdisco
|
|||||||
provides:
|
provides:
|
||||||
App::Netdisco:
|
App::Netdisco:
|
||||||
file: lib/App/Netdisco.pm
|
file: lib/App/Netdisco.pm
|
||||||
version: 2.035999_003
|
version: 2.035999_006
|
||||||
App::Netdisco::AnyEvent::Nbtstat:
|
App::Netdisco::AnyEvent::Nbtstat:
|
||||||
file: lib/App/Netdisco/AnyEvent/Nbtstat.pm
|
file: lib/App/Netdisco/AnyEvent/Nbtstat.pm
|
||||||
App::Netdisco::Backend::Job:
|
App::Netdisco::Backend::Job:
|
||||||
@@ -427,6 +427,7 @@ requires:
|
|||||||
Sereal: '0'
|
Sereal: '0'
|
||||||
Socket6: '0.23'
|
Socket6: '0.23'
|
||||||
Starman: '0.4008'
|
Starman: '0.4008'
|
||||||
|
Sys::Proctitle: '0'
|
||||||
Template: '2.24'
|
Template: '2.24'
|
||||||
Template::Plugin::CSV: '0.04'
|
Template::Plugin::CSV: '0.04'
|
||||||
Template::Plugin::Number::Format: '1.02'
|
Template::Plugin::Number::Format: '1.02'
|
||||||
@@ -446,5 +447,5 @@ resources:
|
|||||||
homepage: http://netdisco.org/
|
homepage: http://netdisco.org/
|
||||||
license: http://opensource.org/licenses/bsd-license.php
|
license: http://opensource.org/licenses/bsd-license.php
|
||||||
repository: https://github.com/netdisco/netdisco
|
repository: https://github.com/netdisco/netdisco
|
||||||
version: 2.035999_003
|
version: 2.035999_006
|
||||||
x_serialization_backend: 'CPAN::Meta::YAML version 0.011'
|
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ foreach my $d (@devices) {
|
|||||||
my $old = $d->get_column( 'old' );
|
my $old = $d->get_column( 'old' );
|
||||||
my $devgroup = 'other';
|
my $devgroup = 'other';
|
||||||
foreach my $g (keys %$groups) {
|
foreach my $g (keys %$groups) {
|
||||||
if (check_acl( $d, $groups->{$g} )) {
|
if (check_acl_only( $d, $groups->{$g} )) {
|
||||||
$devgroup = $g;
|
$devgroup = $g;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use 5.010_000;
|
use 5.010_000;
|
||||||
|
|
||||||
our $VERSION = '2.035999_003';
|
our $VERSION = '2.035999_006';
|
||||||
use App::Netdisco::Configuration;
|
use App::Netdisco::Configuration;
|
||||||
|
|
||||||
use Module::Find ();
|
use Module::Find ();
|
||||||
@@ -207,7 +207,7 @@ Notes|App::Netdisco::Manual::ReleaseNotes>. Then, the process is as follows:
|
|||||||
|
|
||||||
# upgrade Netdisco
|
# upgrade Netdisco
|
||||||
~/bin/localenv cpanm --notest App::Netdisco
|
~/bin/localenv cpanm --notest App::Netdisco
|
||||||
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/
|
ln -sf ~/perl5/bin/{localenv,netdisco-*} ~/bin/
|
||||||
|
|
||||||
# apply database schema updates
|
# apply database schema updates
|
||||||
~/bin/netdisco-deploy
|
~/bin/netdisco-deploy
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use Dancer::Plugin::DBIC 'schema';
|
|||||||
|
|
||||||
use App::Netdisco::Util::Device
|
use App::Netdisco::Util::Device
|
||||||
qw/get_device match_devicetype is_discoverable/;
|
qw/get_device match_devicetype is_discoverable/;
|
||||||
|
use App::Netdisco::Util::Permission 'check_acl_only';
|
||||||
use App::Netdisco::Util::DNS ':all';
|
use App::Netdisco::Util::DNS ':all';
|
||||||
use App::Netdisco::JobQueue qw/jq_queued jq_insert/;
|
use App::Netdisco::JobQueue qw/jq_queued jq_insert/;
|
||||||
use NetAddr::IP::Lite ':lower';
|
use NetAddr::IP::Lite ':lower';
|
||||||
@@ -76,8 +77,8 @@ sub set_canonical_ip {
|
|||||||
|
|
||||||
foreach my $key (sort keys %$map) {
|
foreach my $key (sort keys %$map) {
|
||||||
# lhs matches device, rhs matches device_ip
|
# lhs matches device, rhs matches device_ip
|
||||||
if (check_acl($device, $key)
|
if (check_acl_only($device, $key)
|
||||||
and check_acl($alias, $map->{$key})) {
|
and check_acl_only($alias, $map->{$key})) {
|
||||||
|
|
||||||
if ($snmp->snmp_connect_ip( $alias->alias )) {
|
if ($snmp->snmp_connect_ip( $alias->alias )) {
|
||||||
$new_ip = $alias->alias;
|
$new_ip = $alias->alias;
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ sub jq_queued {
|
|||||||
sub _get_denied_actions {
|
sub _get_denied_actions {
|
||||||
my $device = shift;
|
my $device = shift;
|
||||||
my @badactions = ();
|
my @badactions = ();
|
||||||
|
return @badactions unless $device;
|
||||||
|
|
||||||
push @badactions, ('discover', @{ setting('job_prio')->{high} })
|
push @badactions, ('discover', @{ setting('job_prio')->{high} })
|
||||||
if not is_discoverable($device);
|
if not is_discoverable($device);
|
||||||
@@ -142,17 +143,19 @@ sub jq_lock {
|
|||||||
$fqdn ||= (hostfqdn || 'localhost');
|
$fqdn ||= (hostfqdn || 'localhost');
|
||||||
my $happy = false;
|
my $happy = false;
|
||||||
|
|
||||||
# need to handle device discovered since backend daemon started
|
if ($job->device) {
|
||||||
# and the skiplist was primed. these should be checked against
|
# need to handle device discovered since backend daemon started
|
||||||
# the various acls and have device_skip entry added if needed,
|
# and the skiplist was primed. these should be checked against
|
||||||
# and return false if it should have been skipped.
|
# the various acls and have device_skip entry added if needed,
|
||||||
my @badactions = _get_denied_actions($job->device);
|
# and return false if it should have been skipped.
|
||||||
if (scalar @badactions) {
|
my @badactions = _get_denied_actions($job->device);
|
||||||
schema('netdisco')->resultset('DeviceSkip')->find_or_create({
|
if (scalar @badactions) {
|
||||||
backend => $fqdn, device => $job->device,
|
schema('netdisco')->resultset('DeviceSkip')->find_or_create({
|
||||||
},{ key => 'device_skip_pkey' })->add_to_actionset(@badactions);
|
backend => $fqdn, device => $job->device,
|
||||||
|
},{ key => 'device_skip_pkey' })->add_to_actionset(@badactions);
|
||||||
|
|
||||||
return false if scalar grep {$_ eq $job->action} @badactions;
|
return false if scalar grep {$_ eq $job->action} @badactions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# lock db row and update to show job has been picked
|
# lock db row and update to show job has been picked
|
||||||
@@ -200,9 +203,11 @@ sub jq_defer {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
schema('netdisco')->txn_do(sub {
|
schema('netdisco')->txn_do(sub {
|
||||||
schema('netdisco')->resultset('DeviceSkip')->find_or_create({
|
if ($job->device) {
|
||||||
backend => $fqdn, device => $job->device,
|
schema('netdisco')->resultset('DeviceSkip')->find_or_create({
|
||||||
},{ key => 'device_skip_pkey' })->increment_deferrals;
|
backend => $fqdn, device => $job->device,
|
||||||
|
},{ key => 'device_skip_pkey' })->increment_deferrals;
|
||||||
|
}
|
||||||
|
|
||||||
# lock db row and update to show job is available
|
# lock db row and update to show job is available
|
||||||
schema('netdisco')->resultset('Admin')
|
schema('netdisco')->resultset('Admin')
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use Net::DNS;
|
|||||||
use AnyEvent::DNS;
|
use AnyEvent::DNS;
|
||||||
use NetAddr::IP::Lite ':lower';
|
use NetAddr::IP::Lite ':lower';
|
||||||
|
|
||||||
use App::Netdisco::Util::Permission 'check_acl';
|
use App::Netdisco::Util::Permission;
|
||||||
|
|
||||||
use base 'Exporter';
|
use base 'Exporter';
|
||||||
our @EXPORT = ();
|
our @EXPORT = ();
|
||||||
@@ -129,7 +129,7 @@ sub hostnames_resolve_async {
|
|||||||
|
|
||||||
IP: foreach my $hash_ref (@$ips) {
|
IP: foreach my $hash_ref (@$ips) {
|
||||||
my $ip = $hash_ref->{'ip'} || $hash_ref->{'alias'};
|
my $ip = $hash_ref->{'ip'} || $hash_ref->{'alias'};
|
||||||
next IP if check_acl($ip, $skip);
|
next IP if App::Netdisco::Util::Permission::check_acl_no($ip, $skip);
|
||||||
|
|
||||||
# check /etc/hosts file and short-circuit if found
|
# check /etc/hosts file and short-circuit if found
|
||||||
foreach my $name (reverse sort keys %HOSTS) {
|
foreach my $name (reverse sort keys %HOSTS) {
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ Returns false if the host is not permitted to arpnip the target device.
|
|||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub is_arpnipable_now {
|
sub is_arpnipable_now {
|
||||||
my $ip = shift;
|
my ($ip) = @_;
|
||||||
my $device = get_device($ip) or return 0;
|
my $device = get_device($ip) or return 0;
|
||||||
|
|
||||||
return _bail_msg("is_arpnipable: cannot arpnip an undiscovered device")
|
return _bail_msg("is_arpnipable: cannot arpnip an undiscovered device")
|
||||||
@@ -290,7 +290,7 @@ Returns false if the host is not permitted to macsuck the target device.
|
|||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub is_macsuckable_now {
|
sub is_macsuckable_now {
|
||||||
my $ip = shift;
|
my ($ip) = @_;
|
||||||
my $device = get_device($ip) or return 0;
|
my $device = get_device($ip) or return 0;
|
||||||
|
|
||||||
return _bail_msg("is_macsuckable: cannot macsuck an undiscovered device")
|
return _bail_msg("is_macsuckable: cannot macsuck an undiscovered device")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package App::Netdisco::Util::SNMP;
|
|||||||
|
|
||||||
use Dancer qw/:syntax :script/;
|
use Dancer qw/:syntax :script/;
|
||||||
use App::Netdisco::Util::Device 'get_device';
|
use App::Netdisco::Util::Device 'get_device';
|
||||||
use App::Netdisco::Util::Permission qw/check_acl_no check_acl/;
|
use App::Netdisco::Util::Permission ':all';
|
||||||
|
|
||||||
use SNMP::Info;
|
use SNMP::Info;
|
||||||
use Try::Tiny;
|
use Try::Tiny;
|
||||||
@@ -300,7 +300,7 @@ sub _build_communities {
|
|||||||
if not $stanza->{tag}
|
if not $stanza->{tag}
|
||||||
and !exists $stanza->{community};
|
and !exists $stanza->{community};
|
||||||
|
|
||||||
if ($stanza->{$mode} and check_acl($device, $stanza->{only})) {
|
if ($stanza->{$mode} and check_acl_only($device, $stanza->{only})) {
|
||||||
if ($device->in_storage and
|
if ($device->in_storage and
|
||||||
$stored_tag and $stored_tag eq $stanza->{tag}) {
|
$stored_tag and $stored_tag eq $stanza->{tag}) {
|
||||||
# last known-good by tag
|
# last known-good by tag
|
||||||
|
|||||||
Reference in New Issue
Block a user