Fixing bug 3876, reutrn with usage if no kitcomponent specified to addkitcomp/rmkitcomp

This commit is contained in:
wanghuaz 2013-11-06 18:22:11 +08:00
parent c9c4bca217
commit 2af02291a6

View File

@ -1790,12 +1790,13 @@ sub addkitcomp
my $rc;
my $xusage = sub {
my $ret = shift;
my %rsp;
push@{ $rsp{data} }, "Usage: addkitcomp - Add a Kit component to an xCAT osimage.";
push@{ $rsp{data} }, "\taddkitcomp [-h|--help]";
push@{ $rsp{data} }, "\taddkitcomp [-v|--version]";
push@{ $rsp{data} }, "\taddkitcomp [-V|--verbose] [-a|--adddeps] [-f|--force] \n\t\t[-n|--noupgrade] -i <osimage> <kitcompname_list>";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
xCAT::MsgUtils->message( "I", \%rsp, $callback, $ret );
};
if ($^O ne 'linux') {
@ -1833,6 +1834,13 @@ sub addkitcomp
return 1; # no usage - just exit
}
unless(scalar @ARGV)
{
$xusage->(1);
return 1;
}
my %tabs = ();
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
foreach my $t ( @tables ) {
@ -2316,12 +2324,13 @@ sub rmkitcomp
my $rc;
my $xusage = sub {
my $ret = shift;
my %rsp;
push@{ $rsp{data} }, "Usage: rmkitcomp - Remove Kit components from an xCAT osimage.";
push@{ $rsp{data} }, "\trmkitcomp [-h|--help]";
push@{ $rsp{data} }, "\trmkitcomp [-v|--version]";
push@{ $rsp{data} }, "\trmkitcomp [-V|--verbose] [-u|--uninstall] [-f|--force] \n\t\t-i <osimage> <kitcompname_list>";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
xCAT::MsgUtils->message( "I", \%rsp, $callback, $ret );
};
if ($^O ne 'linux') {
@ -2359,6 +2368,13 @@ sub rmkitcomp
return 1; # no usage - just exit
}
unless(scalar @ARGV)
{
$xusage->(1);
return 1;
}
my %tabs = ();
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
foreach my $t ( @tables ) {