2009-11-24 15:12:39 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
|
|
|
package xCAT_plugin::AAAusage;
|
|
|
|
use strict;
|
|
|
|
##########################################################################
|
|
|
|
# Common help plugin for table-driven commands
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Command handler method from tables
|
|
|
|
##########################################################################
|
|
|
|
sub handled_commands {
|
|
|
|
return {
|
|
|
|
rnetboot => 'AAAusage',
|
|
|
|
rpower => 'AAAusage',
|
|
|
|
rbeacon => 'AAAusage',
|
|
|
|
rvitals => 'AAAusage',
|
|
|
|
reventlog => 'AAAusage',
|
|
|
|
rinv => 'AAAusage',
|
|
|
|
rsetboot => 'AAAusage',
|
|
|
|
rbootseq => 'AAAusage',
|
|
|
|
rscan => 'AAAusage',
|
|
|
|
rspconfig => 'AAAusage',
|
|
|
|
getmacs => 'AAAusage',
|
|
|
|
mkvm => 'AAAusage',
|
|
|
|
lsvm => 'AAAusage',
|
|
|
|
chvm => 'AAAusage',
|
|
|
|
rmvm => 'AAAusage',
|
|
|
|
lsslp => 'AAAusage',
|
|
|
|
rflash => 'AAAusage',
|
|
|
|
mkhwconn => 'AAAusage',
|
|
|
|
rmhwconn => 'AAAusage',
|
|
|
|
lshwconn => 'AAAusage',
|
2010-08-12 09:07:05 +00:00
|
|
|
renergy => 'AAAusage',
|
|
|
|
nodeset => 'AAAusage'
|
2009-11-24 15:12:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Pre-process request from xCat daemon
|
|
|
|
##########################################################################
|
|
|
|
sub preprocess_request {
|
|
|
|
my $request = shift;
|
|
|
|
#if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
|
|
|
|
|
|
|
if (($request->{_xcatpreprocessed}) and ($request->{_xcatpreprocessed}->[0] == 1) ) { return [$request]; }
|
|
|
|
my $callback=shift;
|
|
|
|
my @requests;
|
|
|
|
|
|
|
|
#display usage statement if -h is present or no noderage is specified
|
|
|
|
my $noderange = $request->{node}; #Should be arrayref
|
|
|
|
my $command = $request->{command}->[0];
|
|
|
|
my $extrargs = $request->{arg};
|
|
|
|
my @exargs=($request->{arg});
|
|
|
|
if (ref($extrargs)) {
|
|
|
|
@exargs=@$extrargs;
|
|
|
|
}
|
2010-10-15 06:43:38 +00:00
|
|
|
if (($#exargs==-1) or (($#exargs==0) and ($exargs[0] =~ /^\s*$/)) or (!$noderange and $command ne "lsslp")) {
|
2009-11-24 15:12:39 +00:00
|
|
|
$exargs[0] = "--help"; # force help if no args
|
|
|
|
}
|
|
|
|
|
|
|
|
my $usage_string=xCAT::Usage->parseCommand($command, @exargs);
|
|
|
|
if ($usage_string) {
|
|
|
|
$callback->({data=>[$usage_string]});
|
|
|
|
$request = {};
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Process request from xCat daemon
|
|
|
|
##########################################################################
|
|
|
|
sub process_request {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1;
|