From bbeda4bfa7d82cb62dc18cefc5d7d2d92767473d Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 16 Sep 2014 19:34:56 +0100 Subject: [PATCH 01/20] Add Dancer import to SSHCollector Platforms --- Netdisco/Changes | 6 +++++- Netdisco/lib/App/Netdisco/SSHCollector/Platform/ACE.pm | 3 ++- Netdisco/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm | 1 + Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOS.pm | 1 - Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm | 3 +-- Netdisco/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm | 3 +-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 4a63b7e2..232f5d8d 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -2,7 +2,11 @@ [ENHANCEMENTS] - * Setting for items in number of records per table page menu (table_showrecordsmenu). + * [#144] Setting for items in number of records per table page menu (table_showrecordsmenu). + + [BUG FIXES] + + * Add Dancer import to SSHCollector Platforms 2.029007 - 2014-09-12 diff --git a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/ACE.pm b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/ACE.pm index 9cb1b1b8..f518a365 100644 --- a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/ACE.pm +++ b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/ACE.pm @@ -23,8 +23,9 @@ the same context. use strict; use warnings; -use Moo; +use Dancer ':script'; use Expect; +use Moo; =head1 PUBLIC METHODS diff --git a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm index 7feb553b..a9de9e1a 100644 --- a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm +++ b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm @@ -22,6 +22,7 @@ can't be executed, falls back to the latter. use strict; use warnings; +use Dancer ':script'; use Moo; =head1 PUBLIC METHODS diff --git a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOS.pm b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOS.pm index 1165e6d5..36e14cb7 100644 --- a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOS.pm +++ b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOS.pm @@ -16,7 +16,6 @@ use strict; use warnings; use Dancer ':script'; -use Data::Printer; use Moo; =head1 PUBLIC METHODS diff --git a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm index 04404342..9e893d93 100644 --- a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm +++ b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm @@ -16,9 +16,8 @@ use strict; use warnings; use Dancer ':script'; -use Data::Printer; -use Moo; use Expect; +use Moo; =head1 PUBLIC METHODS diff --git a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm index 67ba10dc..458287d8 100644 --- a/Netdisco/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm +++ b/Netdisco/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm @@ -16,9 +16,8 @@ use strict; use warnings; use Dancer ':script'; -use Data::Printer; -use Moo; use Expect; +use Moo; =head1 PUBLIC METHODS From 478de3a8f6c0efbfdb2013fb4c135a5ff581eb23 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 23 Sep 2014 20:29:55 +0100 Subject: [PATCH 02/20] release 2.029008 --- Netdisco/Changes | 3 ++- Netdisco/MANIFEST | 1 + Netdisco/META.yml | 3 +-- Netdisco/lib/App/Netdisco.pm | 6 +++++- Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod | 9 +++++++++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 232f5d8d..6404d954 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,4 +1,4 @@ -2.029008 +2.029008 - 2014-09-23 [ENHANCEMENTS] @@ -7,6 +7,7 @@ [BUG FIXES] * Add Dancer import to SSHCollector Platforms + * Add note to docs to workaround current Dancer/YAML::XS issue 2.029007 - 2014-09-12 diff --git a/Netdisco/MANIFEST b/Netdisco/MANIFEST index e1080c3c..ae36a85c 100644 --- a/Netdisco/MANIFEST +++ b/Netdisco/MANIFEST @@ -314,6 +314,7 @@ share/views/ajax/admintask/undiscoveredneighbors.tt share/views/ajax/admintask/undiscoveredneighbors_csv.tt share/views/ajax/admintask/userlog.tt share/views/ajax/admintask/users.tt +share/views/ajax/datatabledefaults.tt share/views/ajax/device/addresses.tt share/views/ajax/device/addresses_csv.tt share/views/ajax/device/details.tt diff --git a/Netdisco/META.yml b/Netdisco/META.yml index f593b944..3f9093b4 100644 --- a/Netdisco/META.yml +++ b/Netdisco/META.yml @@ -71,7 +71,6 @@ requires: Sereal: 0 Socket6: 0.23 Starman: 0.4008 - Sys::Proctitle: 0 Template: 2.24 Template::Plugin::CSV: 0.04 Template::Plugin::Number::Format: 1.02 @@ -91,4 +90,4 @@ resources: homepage: http://netdisco.org/ license: http://opensource.org/licenses/bsd-license.php repository: git://git.code.sf.net/p/netdisco/netdisco-ng -version: 2.029007 +version: 2.029008 diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index 18b750fa..90e2e4e7 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -4,7 +4,7 @@ use strict; use warnings; use 5.010_000; -our $VERSION = '2.029007'; +our $VERSION = '2.029008'; use App::Netdisco::Configuration; use Module::Find (); @@ -123,6 +123,7 @@ install Netdisco and its dependencies into the C user's home area su - netdisco curl -L http://cpanmin.us/ | perl - --notest --local-lib ~/perl5 App::Netdisco + ~/bin/localenv cpanm --force https://cpan.metacpan.org/authors/id/Y/YA/YANICK/Dancer-1.3126.tar.gz Link some of the newly installed apps into a handy location: @@ -198,6 +199,9 @@ Notes|App::Netdisco::Manual::ReleaseNotes>. Then, the process is as follows: # upgrade Netdisco ~/bin/localenv cpanm --notest App::Netdisco + # workaround for current upstream bug + ~/bin/localenv cpanm --force https://cpan.metacpan.org/authors/id/Y/YA/YANICK/Dancer-1.3126.tar.gz + # apply database schema updates ~/bin/netdisco-deploy diff --git a/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod b/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod index 5bb9fd94..18460a92 100644 --- a/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod +++ b/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod @@ -36,6 +36,15 @@ but they are backwards compatible. =back +=head1 2.029008 + +=head2 General Notices + +When upgrading you will encounter a current incompatibility between Netdisco +and one of its components. To work around this, issue the following command: + + ~/bin/localenv cpanm --force https://cpan.metacpan.org/authors/id/Y/YA/YANICK/Dancer-1.3126.tar.gz + =head1 2.029002 =head2 General Notices From fc3bda77cbf8f95241b997fa5bcf3c0e3a2e809b Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 27 Sep 2014 10:57:59 +0100 Subject: [PATCH 03/20] better way to specify Dancer force version --- Netdisco/lib/App/Netdisco.pm | 4 ++-- Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index 90e2e4e7..54399359 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -123,7 +123,7 @@ install Netdisco and its dependencies into the C user's home area su - netdisco curl -L http://cpanmin.us/ | perl - --notest --local-lib ~/perl5 App::Netdisco - ~/bin/localenv cpanm --force https://cpan.metacpan.org/authors/id/Y/YA/YANICK/Dancer-1.3126.tar.gz + ~/bin/localenv cpanm --notest --force Dancer@1.3126 Link some of the newly installed apps into a handy location: @@ -200,7 +200,7 @@ Notes|App::Netdisco::Manual::ReleaseNotes>. Then, the process is as follows: ~/bin/localenv cpanm --notest App::Netdisco # workaround for current upstream bug - ~/bin/localenv cpanm --force https://cpan.metacpan.org/authors/id/Y/YA/YANICK/Dancer-1.3126.tar.gz + ~/bin/localenv cpanm --notest --force Dancer@1.3126 # apply database schema updates ~/bin/netdisco-deploy diff --git a/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod b/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod index 18460a92..8658e1fa 100644 --- a/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod +++ b/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod @@ -43,7 +43,7 @@ but they are backwards compatible. When upgrading you will encounter a current incompatibility between Netdisco and one of its components. To work around this, issue the following command: - ~/bin/localenv cpanm --force https://cpan.metacpan.org/authors/id/Y/YA/YANICK/Dancer-1.3126.tar.gz + ~/bin/localenv cpanm --notest --force Dancer@1.3126 =head1 2.029002 From f8e150706939c9fbb698f4c9e6bc3d8dc6fd2434 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 27 Sep 2014 10:58:51 +0100 Subject: [PATCH 04/20] require DBIC version which fixes the dupe connection bug --- Netdisco/Makefile.PL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Netdisco/Makefile.PL b/Netdisco/Makefile.PL index 5f1aa25b..236d0259 100644 --- a/Netdisco/Makefile.PL +++ b/Netdisco/Makefile.PL @@ -16,7 +16,7 @@ requires 'Archive::Extract' => 0; requires 'CGI::Expand' => 2.05; requires 'Data::Printer' => 0; requires 'DBD::Pg' => 0; -requires 'DBIx::Class' => 0.08250; +requires 'DBIx::Class' => 0.082800; requires 'DBIx::Class::Helpers' => 2.018004; requires 'Daemon::Control' => 0.001000; requires 'Dancer' => 1.3112; From 4a6081fc58f9ce3be69af039f1115ee98a3aff68 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 27 Sep 2014 11:31:37 +0100 Subject: [PATCH 05/20] add expire_jobs and set default expire times --- Netdisco/Changes | 11 +++++++++++ .../App/Netdisco/Daemon/Worker/Poller/Expiry.pm | 9 +++++++++ Netdisco/lib/App/Netdisco/Manual/Configuration.pod | 14 +++++++++++--- Netdisco/share/config.yml | 7 ++++--- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 6404d954..75b64f27 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,3 +1,14 @@ +2.029009 - 2014-09-27 + + [ENHANCEMENTS] + + * Defaults now exist for all expire tasks + * Added expire_jobs to remove jobs queue items after 14 days + + [BUG FIXES] + + * Require new DBIC version to fix duplicate DB connection problem + 2.029008 - 2014-09-23 [ENHANCEMENTS] diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller/Expiry.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller/Expiry.pm index 2741907d..01d82d4a 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller/Expiry.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller/Expiry.pm @@ -40,6 +40,15 @@ sub expire { }); } + if (setting('expire_jobs') and setting('expire_jobs') > 0) { + schema('netdisco')->txn_do(sub { + schema('netdisco')->resultset('Admin')->search({ + entered => \[q/< (now() - ?::interval)/, + (setting('expire_jobs') * 86400)], + })->delete(); + }); + } + return job_done("Checked expiry for all Devices and Nodes"); } diff --git a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod index b9578d99..36b8e235 100644 --- a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod +++ b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod @@ -724,14 +724,14 @@ seconds as well as integers. =head3 C -Value: Number of Days. +Value: Number of Days. Default: 60 Devices that have not been refreshed in this number of days will be removed. All nodes connected to this device will be removed as well. =head3 C -Value: Number of Days. +Value: Number of Days. Default: 90 Nodes that have not been refreshed in this number of days will be removed from the database. Archived and non-archived nodes are removed. This includes @@ -739,11 +739,19 @@ SwitchPort/MAC and MAC/IP mappings. =head3 C -Value: Number of Days. +Value: Number of Days. Default: 60 Archived data for switch-port/MAC and MAC/IP mappings older than this number of days will be removed. +=head3 C + +Value: Number of Days. Default: 14 + +Jobs which entered the job queue more than this many days ago will be removed +from the queue during the scheduled expiry process (regardless of whether they +were ever run). + =head3 C Value: Settings Tree. Default: diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index 019caae8..7e14a201 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -130,9 +130,10 @@ nbtstat_only: [] nbtstat_max_age: 7 nbtstat_interval: 0.02 nbtstat_timeout: 1 -expire_devices: 0 -expire_nodes: 0 -expire_nodes_archive: 0 +expire_devices: 60 +expire_nodes: 90 +expire_nodes_archive: 60 +expire_jobs: 14 store_wireless_clients: true store_modules: true ignore_interfaces: From d3a6f3e526072b740ed550c90241bb978c889da6 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 27 Sep 2014 11:33:47 +0100 Subject: [PATCH 06/20] update M::I --- Netdisco/META.yml | 6 +++--- Netdisco/inc/Module/Install.pm | 18 +++++++++--------- Netdisco/inc/Module/Install/Base.pm | 2 +- Netdisco/inc/Module/Install/Can.pm | 2 +- Netdisco/inc/Module/Install/Fetch.pm | 2 +- Netdisco/inc/Module/Install/Makefile.pm | 4 ++-- Netdisco/inc/Module/Install/Metadata.pm | 6 +++--- Netdisco/inc/Module/Install/Scripts.pm | 2 +- Netdisco/inc/Module/Install/Share.pm | 2 +- Netdisco/inc/Module/Install/Win32.pm | 2 +- Netdisco/inc/Module/Install/WriteAll.pm | 2 +- Netdisco/lib/App/Netdisco.pm | 2 +- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Netdisco/META.yml b/Netdisco/META.yml index 3f9093b4..55ce73f7 100644 --- a/Netdisco/META.yml +++ b/Netdisco/META.yml @@ -10,7 +10,7 @@ configure_requires: ExtUtils::MakeMaker: 6.59 distribution_type: module dynamic_config: 1 -generated_by: 'Module::Install version 1.06' +generated_by: 'Module::Install version 1.12' license: bsd meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -35,7 +35,7 @@ requires: Archive::Extract: 0 CGI::Expand: 2.05 DBD::Pg: 0 - DBIx::Class: 0.0825 + DBIx::Class: 0.0828 DBIx::Class::Helpers: 2.018004 Daemon::Control: 0.001 Dancer: 1.3112 @@ -90,4 +90,4 @@ resources: homepage: http://netdisco.org/ license: http://opensource.org/licenses/bsd-license.php repository: git://git.code.sf.net/p/netdisco/netdisco-ng -version: 2.029008 +version: '2.029009' diff --git a/Netdisco/inc/Module/Install.pm b/Netdisco/inc/Module/Install.pm index 4ecf46b9..5460dd50 100644 --- a/Netdisco/inc/Module/Install.pm +++ b/Netdisco/inc/Module/Install.pm @@ -17,7 +17,7 @@ package Module::Install; # 3. The ./inc/ version of Module::Install loads # } -use 5.005; +use 5.006; use strict 'vars'; use Cwd (); use File::Find (); @@ -31,7 +31,7 @@ BEGIN { # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. - $VERSION = '1.06'; + $VERSION = '1.12'; # Storage for the pseudo-singleton $MAIN = undef; @@ -156,10 +156,10 @@ END_DIE sub autoload { my $self = shift; my $who = $self->_caller; - my $cwd = Cwd::cwd(); + my $cwd = Cwd::getcwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { - my $pwd = Cwd::cwd(); + my $pwd = Cwd::getcwd(); if ( my $code = $sym->{$pwd} ) { # Delegate back to parent dirs goto &$code unless $cwd eq $pwd; @@ -239,7 +239,7 @@ sub new { # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); - unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; @@ -338,7 +338,7 @@ sub find_extensions { if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { my $content = Module::Install::_read($subpath . '.pm'); my $in_pod = 0; - foreach ( split //, $content ) { + foreach ( split /\n/, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text @@ -434,7 +434,7 @@ END_OLD # _version is for processing module versions (eg, 1.03_05) not # Perl versions (eg, 5.8.1). -sub _version ($) { +sub _version { my $s = shift || 0; my $d =()= $s =~ /(\.)/g; if ( $d >= 2 ) { @@ -450,12 +450,12 @@ sub _version ($) { return $l + 0; } -sub _cmp ($$) { +sub _cmp { _version($_[1]) <=> _version($_[2]); } # Cloned from Params::Util::_CLASS -sub _CLASS ($) { +sub _CLASS { ( defined $_[0] and diff --git a/Netdisco/inc/Module/Install/Base.pm b/Netdisco/inc/Module/Install/Base.pm index 802844aa..f9bf5de5 100644 --- a/Netdisco/inc/Module/Install/Base.pm +++ b/Netdisco/inc/Module/Install/Base.pm @@ -4,7 +4,7 @@ package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; } # Suspend handler for "redefined" warnings diff --git a/Netdisco/inc/Module/Install/Can.pm b/Netdisco/inc/Module/Install/Can.pm index 22167b8f..b4e5e3b4 100644 --- a/Netdisco/inc/Module/Install/Can.pm +++ b/Netdisco/inc/Module/Install/Can.pm @@ -8,7 +8,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff --git a/Netdisco/inc/Module/Install/Fetch.pm b/Netdisco/inc/Module/Install/Fetch.pm index bee0c4fb..54f14fb5 100644 --- a/Netdisco/inc/Module/Install/Fetch.pm +++ b/Netdisco/inc/Module/Install/Fetch.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff --git a/Netdisco/inc/Module/Install/Makefile.pm b/Netdisco/inc/Module/Install/Makefile.pm index 7052f365..81cddd55 100644 --- a/Netdisco/inc/Module/Install/Makefile.pm +++ b/Netdisco/inc/Module/Install/Makefile.pm @@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/; use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } @@ -133,7 +133,7 @@ sub makemaker_args { return $args; } -# For mm args that take multiple space-seperated args, +# For mm args that take multiple space-separated args, # append an argument to the current list. sub makemaker_append { my $self = shift; diff --git a/Netdisco/inc/Module/Install/Metadata.pm b/Netdisco/inc/Module/Install/Metadata.pm index 58430f30..2c66b1e2 100644 --- a/Netdisco/inc/Module/Install/Metadata.pm +++ b/Netdisco/inc/Module/Install/Metadata.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } @@ -347,7 +347,7 @@ sub name_from { ^ \s* package \s* ([\w:]+) - \s* ; + [\s|;]* /ixms ) { my ($name, $module_name) = ($1, $1); @@ -705,7 +705,7 @@ sub _write_mymeta_data { my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); my $meta = $yaml[0]; - # Overwrite the non-configure dependency hashs + # Overwrite the non-configure dependency hashes delete $meta->{requires}; delete $meta->{build_requires}; delete $meta->{recommends}; diff --git a/Netdisco/inc/Module/Install/Scripts.pm b/Netdisco/inc/Module/Install/Scripts.pm index 419286f3..66a33504 100644 --- a/Netdisco/inc/Module/Install/Scripts.pm +++ b/Netdisco/inc/Module/Install/Scripts.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff --git a/Netdisco/inc/Module/Install/Share.pm b/Netdisco/inc/Module/Install/Share.pm index 4e2b602a..a67f6e00 100644 --- a/Netdisco/inc/Module/Install/Share.pm +++ b/Netdisco/inc/Module/Install/Share.pm @@ -8,7 +8,7 @@ use ExtUtils::Manifest (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff --git a/Netdisco/inc/Module/Install/Win32.pm b/Netdisco/inc/Module/Install/Win32.pm index eeaa3fed..e48c32d9 100644 --- a/Netdisco/inc/Module/Install/Win32.pm +++ b/Netdisco/inc/Module/Install/Win32.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff --git a/Netdisco/inc/Module/Install/WriteAll.pm b/Netdisco/inc/Module/Install/WriteAll.pm index 85d8018c..409ef40c 100644 --- a/Netdisco/inc/Module/Install/WriteAll.pm +++ b/Netdisco/inc/Module/Install/WriteAll.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.06'; + $VERSION = '1.12'; @ISA = qw{Module::Install::Base}; $ISCORE = 1; } diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index 54399359..a6f8832f 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -4,7 +4,7 @@ use strict; use warnings; use 5.010_000; -our $VERSION = '2.029008'; +our $VERSION = '2.029009'; use App::Netdisco::Configuration; use Module::Find (); From f6b11129313500ead929e5fd4268ff59375d303d Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 29 Sep 2014 21:35:57 +0100 Subject: [PATCH 07/20] Administration (SSH, Telnet, Web) links for devices --- Netdisco/Changes | 6 ++++++ Netdisco/share/views/ajax/device/details.tt | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/Netdisco/Changes b/Netdisco/Changes index 75b64f27..c3ab0a5d 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,3 +1,9 @@ +2.029010 + + [NEW FEATURES] + + * Administration (SSH, Telnet, Web) links for devices + 2.029009 - 2014-09-27 [ENHANCEMENTS] diff --git a/Netdisco/share/views/ajax/device/details.tt b/Netdisco/share/views/ajax/device/details.tt index 0882bf0c..6d27a2b6 100644 --- a/Netdisco/share/views/ajax/device/details.tt +++ b/Netdisco/share/views/ajax/device/details.tt @@ -80,6 +80,17 @@ [% END %] [% END %] + + Administration + + + SSH + + Telnet + + Web + + Uptime [% d.uptime_age | html_entity %] From cd22c741e51cdb645eba008d130ee25f3c1f8377 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 30 Sep 2014 08:02:15 +0100 Subject: [PATCH 08/20] initial support for bind params in custom reports --- Netdisco/lib/App/Netdisco/Web/GenericReport.pm | 11 +++++++---- Netdisco/lib/App/Netdisco/Web/Plugin.pm | 13 ++++++++++--- Netdisco/share/views/report.tt | 1 + .../share/views/sidebar/report/generic_report.tt | 4 ++++ 4 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 Netdisco/share/views/sidebar/report/generic_report.tt diff --git a/Netdisco/lib/App/Netdisco/Web/GenericReport.pm b/Netdisco/lib/App/Netdisco/Web/GenericReport.pm index bc31e19d..4d23d25d 100644 --- a/Netdisco/lib/App/Netdisco/Web/GenericReport.pm +++ b/Netdisco/lib/App/Netdisco/Web/GenericReport.pm @@ -22,11 +22,10 @@ foreach my $report (@{setting('reports')}) { }); get "/ajax/content/report/$r" => require_login sub { - my $rs = schema('netdisco')->resultset('Virtual::GenericReport')->result_source; - # TODO: this should be done by creating a new Virtual Result class on # the fly (package...) and then calling DBIC register_class on it. + my $rs = schema('netdisco')->resultset('Virtual::GenericReport')->result_source; $rs->view_definition($report->{query}); $rs->remove_columns($rs->columns); $rs->add_columns( exists $report->{query_columns} @@ -35,13 +34,17 @@ foreach my $report (@{setting('reports')}) { ); my $set = schema('netdisco')->resultset('Virtual::GenericReport') - ->search(undef, {result_class => 'DBIx::Class::ResultClass::HashRefInflator'}); + ->search(undef, { + result_class => 'DBIx::Class::ResultClass::HashRefInflator', + ( (exists $report->{bind_params}) + ? (bind => [map { param($_) } @{ $report->{bind_params} }]) : () ), + }); @data = $set->all; # Data Munging support... my $compartment = Safe->new; - $config = $report; + $config = $report; # closure for the config of this report $compartment->share(qw/$config @data/); $compartment->permit_only(qw/:default sort/); diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin.pm b/Netdisco/lib/App/Netdisco/Web/Plugin.pm index adffac6b..17d4b503 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin.pm @@ -169,15 +169,22 @@ register 'register_report' => sub { return error "bad config to register_report"; } - foreach my $item (@{setting('_reports_menu')->{ $config->{category} }}) { - if ($item eq $config->{tag}) { - setting('_reports')->{$config->{tag}} = $config; + foreach my $tag (@{setting('_reports_menu')->{ $config->{category} }}) { + if ($tag eq $config->{tag}) { + setting('_reports')->{$tag} = $config; return; } } push @{setting('_reports_menu')->{ $config->{category} }}, $config->{tag}; setting('_reports')->{$config->{tag}} = $config; + + foreach my $rconfig (@{setting('reports')}) { + if ($rconfig->{tag} eq $config->{tag}) { + setting('_reports')->{$config->{tag}}->{'rconfig'} = $rconfig; + last; + } + } }; register_plugin; diff --git a/Netdisco/share/views/report.tt b/Netdisco/share/views/report.tt index d1d47bc3..a08d2c9a 100644 --- a/Netdisco/share/views/report.tt +++ b/Netdisco/share/views/report.tt @@ -17,6 +17,7 @@ [% INCLUDE "sidebar/report/${report.tag}.tt" %] [% CATCH %] + [% INCLUDE "sidebar/report/generic_report.tt" %] [% END %] diff --git a/Netdisco/share/views/sidebar/report/generic_report.tt b/Netdisco/share/views/sidebar/report/generic_report.tt new file mode 100644 index 00000000..008b3b27 --- /dev/null +++ b/Netdisco/share/views/sidebar/report/generic_report.tt @@ -0,0 +1,4 @@ + +[% FOREACH k IN report.rconfig.bind_params %] + +[% END %] From 745a3b7a638b56c2d46a90e973917b4ee8fa8b3e Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 4 Oct 2014 15:04:05 +0100 Subject: [PATCH 09/20] explicit note on upgrading instruction about pre-2.x --- Netdisco/lib/App/Netdisco.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index a6f8832f..4113c315 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -191,7 +191,11 @@ Netdisco 2, disable your system's cron jobs for the Netdisco 1.x poller. For further documentation on deployment, see L. -=head1 Upgrading +=head1 Upgrading from 2.x + +If you're running a version of Netdisco prior to 2.x then you should follow +the full installation instructions, above. This process is for upgrading +version 2.x only. Before upgrading please review the latest L. Then, the process is as follows: From 7630b6ec7bf033a892a9fea16807a60f3b76558a Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 5 Oct 2014 12:34:02 +0100 Subject: [PATCH 10/20] support override of reports --- Netdisco/lib/App/Netdisco/Web/Plugin.pm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin.pm b/Netdisco/lib/App/Netdisco/Web/Plugin.pm index 17d4b503..2b4887ac 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin.pm @@ -169,20 +169,21 @@ register 'register_report' => sub { return error "bad config to register_report"; } - foreach my $tag (@{setting('_reports_menu')->{ $config->{category} }}) { - if ($tag eq $config->{tag}) { - setting('_reports')->{$tag} = $config; - return; - } + if (0 == scalar grep {$_ eq $config->{tag}} + @{setting('_reports_menu')->{ $config->{category} }}) { + push @{setting('_reports_menu')->{ $config->{category} }}, $config->{tag}; } - push @{setting('_reports_menu')->{ $config->{category} }}, $config->{tag}; - setting('_reports')->{$config->{tag}} = $config; + foreach my $tag (@{setting('_reports_menu')->{ $config->{category} }}) { + if ($config->{tag} eq $tag) { + setting('_reports')->{$tag} = $config; - foreach my $rconfig (@{setting('reports')}) { - if ($rconfig->{tag} eq $config->{tag}) { - setting('_reports')->{$config->{tag}}->{'rconfig'} = $rconfig; - last; + foreach my $rconfig (@{setting('reports')}) { + if ($rconfig->{tag} eq $tag) { + setting('_reports')->{$tag}->{'rconfig'} = $rconfig; + last; + } + } } } }; From d50dba3eeef5fe52386a888a7d788782d6d6f92d Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 5 Oct 2014 13:00:03 +0100 Subject: [PATCH 11/20] [#143] Pass parameter(s) to custom reports via bind_params config --- Netdisco/Changes | 1 + .../lib/App/Netdisco/Manual/Configuration.pod | 27 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index c3ab0a5d..0664e504 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -3,6 +3,7 @@ [NEW FEATURES] * Administration (SSH, Telnet, Web) links for devices + * [#143] Pass parameter(s) to custom reports via bind_params config 2.029009 - 2014-09-27 diff --git a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod index 36b8e235..ebee0c90 100644 --- a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod +++ b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod @@ -256,16 +256,21 @@ code or HTML templates. For example: FROM device d ORDER BY name -The C of each item in the C configuration is an alias for the +The C of each item in the C configuration is an alias for the report, and becomes part of the web path. You can munge the data retrieved from the database by placing a Perl script -with the same name as the C key into the C directory of -Netdisco's home area. The script can access C<$config> for its configuration -and C<@data> for the retrieved data. It should return a list of munged data. +with the same name as the C key into the "C" directory +of Netdisco's home area. The script can access C<$config> for its +configuration and C<@data> for the retrieved data. It should return a list of +munged data. Within the tree you can provide each of the keys below: +=head4 C + +Alias for the Report, which must be usable in a web path. + =head4 C