Squashed commit of the following:

* Support for stuffing other locations into @INC at runtime
* Reports config is now a list (see ReleaseNotes)

commit 19756faf57
Merge: 2e8afbe 29d3ac7
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Thu Jul 31 21:32:30 2014 +0100

    Merge branch 'master' into og-autoload

    Conflicts:
    	Netdisco/share/public/javascripts/netdisco_portcontrol.js

commit 2e8afbeea6
Merge: d340c3b 18f507e
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 23 20:09:18 2014 +0100

    Merge branch 'master' into og-autoload

commit d340c3b135
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jul 7 22:25:38 2014 +0100

    tweak dirty css

commit 032cd82c46
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jul 6 23:05:17 2014 +0100

    add dirty classes

commit 2b72c989fa
Merge: 1b8ac7c b77025f
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Jul 4 11:28:01 2014 +0100

    Merge branch 'og-autoload' of ssh://git.code.sf.net/p/netdisco/netdisco-ng into og-autoload

commit b77025f34c
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Thu Jul 3 23:35:35 2014 +0100

    hide save icon

commit 5df5a73aed
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 22:31:18 2014 +0100

    blue color

commit a3bf20f074
Merge: 1839f26 db53c00
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 15:17:25 2014 +0100

    Merge branch 'master' into og-autoload

commit 1b8ac7ca1f
Merge: 1839f26 db53c00
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 09:23:31 2014 +0100

    Merge branch 'master' into og-autoload

commit 1839f2634b
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 03:43:53 2014 +0100

    add jquery.fix.clone.js

commit 3eee9f1997
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 00:08:27 2014 +0100

    save button css

commit 95b6cb61b3
Merge: 13957e8 58e5d05
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Jul 1 21:50:01 2014 +0100

    Merge branch 'master' into og-autoload

    Conflicts:
    	Netdisco/share/config.yml

commit 13957e82dc
Merge: bedbec6 6abceba
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 30 22:50:40 2014 +0100

    Merge branch 'og-autoload' of ssh://git.code.sf.net/p/netdisco/netdisco-ng into og-autoload

commit bedbec6b4b
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 30 22:49:49 2014 +0100

    css fixes

commit 6e2d5a4b48
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 30 21:30:26 2014 +0100

    css fixes

commit 755fc92c59
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 30 13:05:43 2014 +0100

    reports now a list not a hash

commit 6abcebafbe
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 29 12:41:47 2014 +0100

    start as non-root if port switch not required

commit e5e0c0c8d1
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Jun 28 13:10:51 2014 +0100

    fix err in docs

commit 6d680aabed
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Jun 28 11:10:23 2014 +0100

    move content

commit d2668d6db7
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Jun 27 00:30:54 2014 +0100

    minor styling

commit e46cbd252d
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Thu Jun 26 23:19:19 2014 +0100

    add bootstrap-switch checkbox styling

commit 5b0a723c9f
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jun 25 22:20:57 2014 +0100

    typo in defaults

commit e45fa89c44
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Jun 24 22:42:45 2014 +0100

    css for configuration pane

commit 62c53a5e49
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 23 23:33:26 2014 +0100

    minor typo

commit caedbdadc6
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 23 20:35:30 2014 +0100

    properly search the template path!! [#103]

commit 5742bc7856
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 22 23:13:53 2014 +0100

    fix registering template paths

commit 2b09476f29
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 22 22:19:35 2014 +0100

    allow INC stuffing via NETDISCO_INC env var

commit 7c47a277be
Merge: 128e96f 3a1cd19
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 22 22:17:11 2014 +0100

    Merge branch 'master' into og-autoload

commit 128e96f9a3
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 22 20:48:01 2014 +0100

    use Module::Find to load Auto things and Web
This commit is contained in:
Oliver Gorwits
2014-07-31 22:54:28 +01:00
parent 29d3ac707b
commit 04d89320a8
12 changed files with 77 additions and 24 deletions

View File

@@ -1,8 +1,10 @@
2.028014
2.029000
[ENHANCEMENTS]
* [#108] Port Bounce port control feature (down and up in succession)
* Support for stuffing other locations into @INC at runtime
* Reports config is now a list (see ReleaseNotes)
[BUG FIXES]

View File

@@ -28,6 +28,7 @@ requires 'HTTP::Tiny' => 0.029;
requires 'JSON' => 0;
requires 'List::MoreUtils' => 0.33;
requires 'MIME::Base64' => 3.13;
requires 'Module::Find' => 0.12;
requires 'Module::Load' => 0.32;
requires 'Moo' => 1.001000;
requires 'MCE' => 1.408;

View File

@@ -12,6 +12,9 @@ BEGIN {
unshift @INC,
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
dir($FindBin::RealBin, 'lib')->stringify;
unshift @INC,
split m/:/, ($ENV{NETDISCO_INC} || '');
}
use App::Netdisco;

View File

@@ -18,6 +18,9 @@ BEGIN {
unshift @INC,
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
dir($FindBin::RealBin, 'lib')->stringify;
unshift @INC,
split m/:/, ($ENV{NETDISCO_INC} || '');
}
use App::Netdisco;

View File

@@ -7,6 +7,9 @@ use 5.010_000;
our $VERSION = '2.028013';
use App::Netdisco::Configuration;
use Module::Find ();
Module::Find::usesub 'App::NetdiscoE::Init';
=head1 NAME
App::Netdisco - An open source web-based network management tool.

View File

@@ -3,6 +3,11 @@ package App::Netdisco::Configuration;
use App::Netdisco::Environment;
use Dancer ':script';
BEGIN {
# stuff useful locations into @INC
unshift @INC, @{ (setting('include_paths') || []) };
}
# set up database schema config from simple config vars
if (ref {} eq ref setting('database')) {
my $name = (setting('database')->{name} || 'netdisco');
@@ -60,6 +65,14 @@ setting('schedule')->{expire} ||= setting('schedule')->{expiry}
if setting('schedule') and exists setting('schedule')->{expiry};
delete config->{'schedule'}->{'expiry'};
# upgrade reports config from hash to list
if (setting('reports') and ref {} eq ref setting('reports')) {
config->{'reports'} = [ map {{
tag => $_,
%{ setting('reports')->{$_} }
}} keys %{ setting('reports') } ];
}
# set max outstanding requests for AnyEvent::DNS
$ENV{'PERL_ANYEVENT_MAX_OUTSTANDING_DNS'}
= setting('dns')->{max_outstanding} || 50;

View File

@@ -72,6 +72,14 @@ Value: Format String. Default: C<< '[%P] %U %L %m' >>.
Structure of the log messages. See L<Dancer::Logger::Abstract/"logger_format">
for details.
=head3 C<include_paths>
Value: List. Default: Empty List.
Additional library paths for the application (both web frontend and backend
poller daemons). You can also use a colon-separated list in the
"C<NETDISCO_INC>" environment variable.
=head2 Web Frontend
=head3 C<domain_suffix>
@@ -224,13 +232,13 @@ C<web_plugins> setting.
=head3 C<reports>
Value: Dictionary of Reports Hashes. Default: None.
Value: List of Reports Hashes. Default: None.
Use this configuration to add reports to Netdisco without writing any Perl
code or HTML templates. For example:
reports:
power_inventory:
- tag: power_inventory
category: Device
label: 'Power Supply Inventory'
columns:
@@ -242,8 +250,8 @@ code or HTML templates. For example:
FROM device d
ORDER BY name
Each key of the C<reports> configuration is an alias for the report, and
becomes part of the web path.
The C<key> of each item in the C<reports> 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<reports> key into the C<site_plugins> directory of
@@ -604,7 +612,7 @@ token-ring-default,fddinet-default,trnet-default.
On some devices, per-VLAN macsuck will timeout with specific VLAN numbers. You
can put those numbers (or their names) into this list to have them skipped.
=head3 C<macsucl_no_devicevlan>
=head3 C<macsuck_no_devicevlan>
Value: List of "IP:vlan-number" or "IP:vlan-name". Default: Empty List.

View File

@@ -36,6 +36,31 @@ but they are backwards compatible.
=back
=head1 2.029000
=head2 General Notices
The configuration item C<reports> is now a list (used to be a dictionary).
Each item in the list must have a C<tag> entry which was previously the
dictionary key. For example, now use:
reports:
- tag: power_inventory
category: Device
label: 'Power Supply Inventory'
columns:
- {name: 'Name'}
- {ps1_type: 'PS1 Type'}
- {ps1_status: 'PS1 Status'}
query: |
SELECT d.name, d.ps1_type, d.ps1_status
FROM device d
WHERE d.ps1_type IS NOT NULL
ORDER BY name
Old configuration will be continue to work, but we recommend you reconfigure
anyway.
=head1 2.028000
=head2 Incompatible Changes

View File

@@ -345,9 +345,9 @@ template file of your own in your plugin, you need a new path:
register_template_path(
dist_dir( 'App-Netdisco-Web-Plugin-Search-MyNewFeature' ));
The registered path will be searched before the built-in C<App::Netdisco>
path. We recommend use of the L<File::ShareDir> module to package and ship
templates along with your plugin, as shown.
The "C<views>" subdirectory of the registered path will be searched before the
built-in C<App::Netdisco> path. We recommend use of the L<File::ShareDir>
module to package and ship templates along with your plugin, as shown.
Each path added using C<register_template_path> is searched I<before> any
existing paths in the template config. See the

View File

@@ -10,20 +10,13 @@ use Socket6 (); # to ensure dependency is met
use HTML::Entities (); # to ensure dependency is met
use URI::QueryParam (); # part of URI, to add helper methods
use Path::Class 'dir';
use Module::Find ();
use Module::Load ();
use App::Netdisco::Util::Web 'interval_to_daterange';
use App::Netdisco::Web::AuthN;
use App::Netdisco::Web::Static;
use App::Netdisco::Web::Search;
use App::Netdisco::Web::Device;
use App::Netdisco::Web::Report;
use App::Netdisco::Web::AdminTask;
use App::Netdisco::Web::TypeAhead;
use App::Netdisco::Web::PortControl;
use App::Netdisco::Web::Statistics;
use App::Netdisco::Web::Password;
use App::Netdisco::Web::GenericReport;
# FIXME: need to avoid splat so that this can be reordered
Module::Find::usesub 'App::NetdiscoE::Web';
Module::Find::usesub 'App::Netdisco::Web';
sub _load_web_plugins {
my $plugin_list = shift;

View File

@@ -11,8 +11,8 @@ use Safe;
use vars qw/$config @data/;
foreach my $r (keys %{setting('reports')}) {
my $report = setting('reports')->{$r};
foreach my $report (@{setting('reports')}) {
my $r = $report->{tag};
register_report({
tag => $r,
@@ -41,7 +41,7 @@ foreach my $r (keys %{setting('reports')}) {
# Data Munging support...
my $compartment = Safe->new;
$config = setting('reports')->{$r};
$config = $report;
$compartment->share(qw/$config @data/);
$compartment->permit_only(qw/:default sort/);

View File

@@ -11,6 +11,7 @@
log: 'warning'
logger_format: '[%P] %U %L %m'
include_paths: []
# ------------
# WEB FRONTEND
@@ -78,7 +79,7 @@ web_plugins:
extra_web_plugins: []
jobqueue_refresh: 10
safe_password_store: true
reports: {}
reports: []
table_pagesize: 10
# -------------
@@ -271,6 +272,7 @@ engines:
start_tag: '[%'
end_tag: '%]'
PRE_CHOMP: 1
INCLUDE_PATH: []
layout: 'main'
plugins:
Auth::Extensible: