From d051f10988e6d9e7542c6b58b3cd6ff6fc632015 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 31 Mar 2010 14:35:49 +0000 Subject: [PATCH] more tabprune interface checking git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5631 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/tabutils.pm | 26 +++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 0a4969b0f..5982acccd 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -593,8 +593,8 @@ sub tabprune push @{$rsp{data}}, " tabprune [eventlog | auditlog] -n [# of records]"; push @{$rsp{data}}, " tabprune [eventlog | auditlog] -i [recid]"; push @{$rsp{data}}, " tabprune [eventlog | auditlog] -p [percentage]"; - push @{$rsp{data}}, " tabprune [-?|-h|--help]"; - push @{$rsp{data}}, " tabprune [-?|-v|--version]"; + push @{$rsp{data}}, " tabprune [-h|--help]"; + push @{$rsp{data}}, " tabprune [-v|--version]"; if ($exitcode) { $rsp{errorcode} = $exitcode; } $cb->(\%rsp); }; @@ -622,12 +622,28 @@ sub tabprune } if (scalar(@ARGV)>1) { $tabprune_usage->(1); return; } my $table = $ARGV[0]; - + if (!(defined $table)) { + my %rsp; + $rsp{data}->[0] = "Table name eventlog or auditlog required."; + $rsp{errorcode} = 1; + $cb->(\%rsp); + return 1; + + } + $table=~ s/\s*//g; # remove blanks + if (($table ne "eventlog") && ($table ne "auditlog")){ + my %rsp; + $rsp{data}->[0] = "Table name eventlog or auditlog required."; + $rsp{errorcode} = 1; + $cb->(\%rsp); + return 1; + + } my %rsp; - push @{$rsp{data}}, "tabprune $table complete"; + push @{$rsp{data}}, "tabprune of $table complete."; $rsp{errorcode} = 0; $cb->(\%rsp); - return; + return 0; } sub getTableColumn {