fix for defect 2993723 and add Verbose mode

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5928 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2010-04-30 13:35:44 +00:00
parent f3ef5ce546
commit 6ed57c7c81
2 changed files with 18 additions and 7 deletions

View File

@ -69,7 +69,7 @@ sub parse_args
{
my $msg;
my $usagemsg =
" dumpxCATdb -h \n dumpxCATdb -v \n dumpxCATdb [-V] [-p] [path to dump directory]\n";
" dumpxCATdb -h \n dumpxCATdb -v \n dumpxCATdb [-V] <-p> [path to dump directory]\n";
Getopt::Long::Configure("posix_default");
Getopt::Long::Configure("no_gnu_compat");
Getopt::Long::Configure("bundling");

View File

@ -15,6 +15,7 @@ use lib "$::XCATROOT/lib/perl";
use Getopt::Long;
use xCAT::MsgUtils;
use xCAT::Utils;
use strict;
#-----------------------------------------------------------------------------
@ -49,11 +50,22 @@ foreach my $table (@files)
my $tablename = $::PATH;
$tablename .= "/";
$tablename .= $table;
$cmd = "tabrestore $tablename";
if ( (!$::ALL) && (($table =~ /^eventlog/) || ($table =~ /^auditlog/))) {
if ($::VERBOSEREST) {
xCAT::MsgUtils->message("I", "Skipping $table\n");
}
next;
}
my $cmd = "tabrestore $tablename";
my @errout = xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{ # error
xCAT::MsgUtils->message("E", "Error running $cmd, @errout\n");
} else {
if ($::VERBOSEREST) {
xCAT::MsgUtils->message("I", "Restoring $table.\n");
}
}
}
}
@ -72,28 +84,27 @@ exit $rc;
sub parse_args
{
my $msg;
my $usagemsg;
my $usagemsg =
" restorexCATdb -h \n restorexCATdb -v \n restorexCATdb [-a] [-V] <-p> [path to restore .csv files]\n";
Getopt::Long::Configure("posix_default");
Getopt::Long::Configure("no_gnu_compat");
Getopt::Long::Configure("bundling");
if (
!GetOptions(
'a|all' => \$::ALL,
'p|path=s' => \$::PATH,
'h|help' => \$::HELP,
'V|verbose' => \$::VERBOSEREST,
'v|version' => \$::VERSION
)
)
{
$usagemsg =
" restorexCATdb -h \n restorexCATdb -v \n restorexCATdb [-p] [path to restore .csv files]\n";
xCAT::MsgUtils->message("E", $usagemsg);
exit 1;
}
if ($::HELP)
{
$usagemsg =
" restorexCATdb -h \n restorexCATdb -v \n restorexCATdb [-p] [path to restore .csv files]\n";
xCAT::MsgUtils->message("I", $usagemsg);
exit 0;
}