From ecc07fc278e1c396b4aec56e3e7c17f0e1738b2d Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 17 Apr 2012 11:38:41 +0000 Subject: [PATCH] 2012-04-17 Sergio Martin * util/pandora_db.pl: Fixed parameters gathering and clean undeveloped options from help for bug 3486190 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5997 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/util/pandora_db.pl | 31 ++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index eaa7820905..df5e7e7676 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2012-04-17 Sergio Martin + + * util/pandora_db.pl: Fixed parameters gathering and + clean undeveloped options from help for bug 3486190 + 2012-04-13 Sergio Martin * util/pandora_manage.pl: Fixed entities trouble in the action diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index e87f2a7400..ec9678d188 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -242,7 +242,7 @@ sub pandora_purgedb ($$) { print "[PURGE] Delete contents in report that have some deleted agents...\n"; db_do ($dbh, "DELETE FROM treport_content WHERE id_agent NOT IN (SELECT id_agente FROM tagente) AND id_agent != 0;"); - print "[PURGE] Delete empty contents in report (like SLA or Exception)...\n" + print "[PURGE] Delete empty contents in report (like SLA or Exception)...\n"; db_do ($dbh, "DELETE FROM treport_content WHERE type LIKE 'exception' AND id_rc NOT IN (SELECT id_report_content FROM treport_content_item);"); db_do ($dbh, "DELETE FROM treport_content WHERE type LIKE 'sla' AND id_rc NOT IN (SELECT id_report_content FROM treport_content_sla_combined);"); } @@ -335,16 +335,24 @@ sub pandora_init ($) { # Load config file from command line help_screen () if ($#ARGV < 0); - - # If there are not valid parameters - foreach my $param (@ARGV) { - + + $conf->{'_pandora_path'} = shift(@ARGV); + + # If there are valid parameters store it + foreach my $param (@ARGV) { # help! help_screen () if ($param =~ m/--*h\w*\z/i ); if ($param =~ m/-p\z/i) { $conf->{'_onlypurge'} = 1; - } else { - $conf->{'_pandora_path'} = $param; + } + else if ($param =~ m/-v\z/i) { + $conf->{'_verbose'} = 1; + } + else if ($param =~ m/-q\z/i) { + $conf->{'_quiet'} = 1; + } + else if ($param =~ m/-d\z/i) { + $conf->{'_debug'} = 1; } } @@ -516,10 +524,11 @@ sub pandora_checkdb_consistency { ############################################################################## sub help_screen{ print "Usage: $0 [options]\n\n"; - print "\n\tAvailable options:\n\t\t-d Debug output (very verbose).\n"; - print "\t\t-v Verbose output.\n"; - print "\t\t-q Quiet output.\n"; - print "\t\t-p Only purge and consistency check, skip compact.\n\n"; + print "\n\tAvailable options:\n"; + #~ print "\t\t-d Debug output (very verbose).\n"; + #~ print "\t\t-v Verbose output.\n"; + #~ print "\t\t-q Quiet output.\n"; + print "\t\t-p Only purge and consistency check, skip compact.\n\n"; exit; }