Title: [opsview] [9707] Fix handling opspacks with no plugins in
- Revision
- 9707
- Author
- dferguson
- Date
- 2012-08-03 17:15:54 +0100 (Fri, 03 Aug 2012)
Log Message
Fix handling opspacks with no plugins in
Opspacks can make good use of already installed plugins so may not include any extras. Fix the opspacks install process to continue if no plugins are included.
Modified Paths
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2012-08-03 15:22:05 UTC (rev 9706)
+++ trunk/CHANGES 2012-08-03 16:15:54 UTC (rev 9707)
@@ -41,6 +41,7 @@
Fixed SLES11 dependency on apache2-mod_php5
Fixed opsview not always correctly starting on reboot (Thanks to Mark Addiss)
Added _javascript_-common as conflicting package on Debian/Ubuntu
+ Fixed opspacks not being installed correctly when no plugins are included
3.201205XX 22nd May 2012
NOTICES:
Modified: trunk/opsview-core/lib/Opsview/ResultSet/MonitorPacks.pm
===================================================================
--- trunk/opsview-core/lib/Opsview/ResultSet/MonitorPacks.pm 2012-08-03 15:22:05 UTC (rev 9706)
+++ trunk/opsview-core/lib/Opsview/ResultSet/MonitorPacks.pm 2012-08-03 16:15:54 UTC (rev 9707)
@@ -167,22 +167,31 @@
# Check plugins if already exists
my @errors;
- opendir DIR, "$packdir/plugins"
- or $logger->logdie( "Cannot open $packdir/plugins/ dir" );
- my @plugins = grep !/^\.\.?/, readdir DIR;
- closedir DIR;
+ my @plugins_to_add_to_db;
+ my @plugins;
+ if ( opendir DIR, "$packdir/plugins" ) {
+ @plugins = grep !/^\.\.?/, readdir DIR;
+ closedir DIR;
- my $plugins_rs = $schema->resultset( "Plugins" );
- my @plugins_to_add_to_db;
- foreach my $p (@plugins) {
- if ( $plugins_rs->find( { name => $p } ) ) {
- push @errors, "Plugin '$p' already exists";
+ my $plugins_rs = $schema->resultset( "Plugins" );
+ foreach my $p (@plugins) {
+ if ( $plugins_rs->find( { name => $p } ) ) {
+ push @errors, "Plugin '$p' already exists";
+ }
+ else {
+ push @plugins_to_add_to_db, $p;
+ }
}
- else {
- push @plugins_to_add_to_db, $p;
- }
}
+ else {
+ # NOTE: some opspacks do not contain plugins, but make use of
+ # already installed ones
+ $logger->debug(
+ "Cannot open $packdir/plugins/ - assuming no plugins in pack"
+ );
+ }
+
# Read config.json
open F, "$packdir/config.json"
or $logger->logdie( "Cannot open $packdir/config.json" );
@@ -385,6 +394,7 @@
foreach my $mp (@monitorpacks) {
( my $packdir = $mp ) =~ s/\.tar\.gz//;
+ $logger->debug( "Reading: $packdir/info" );
my $info = $self->read_info( "$packdir/info" );
# skip already installed OpsPacks
_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins