fix defect 2151155 multiple output for getmacs -h, -v ,etc

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3318 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2009-05-08 13:42:39 +00:00
parent e304bf698c
commit 53bb6a242f
2 changed files with 24 additions and 16 deletions

View File

@ -1100,7 +1100,8 @@ sub preprocess_request {
my $package = shift;
my $req = shift;
if ($req->{_xcatdest}) { return [$req]; } #exit if preprocessed
#if ($req->{_xcatdest}) { return [$req]; } #exit if preprocessed
if ($req->{_xcatpreprocessed}->[0] == 1 ) { return [$req]; }
my $callback = shift;
my @requests;
@ -1123,7 +1124,7 @@ sub preprocess_request {
$package =~ s/xCAT_plugin:://;
####################################
# Prompt for usage if needed
# Prompt for usage if needed and on MN
####################################
my $noderange = $req->{node}; #Should be arrayref
my $command = $req->{command}->[0];
@ -1132,20 +1133,22 @@ sub preprocess_request {
if (ref($extrargs)) {
@exargs=@$extrargs;
}
my $usage_string=xCAT::Usage->parseCommand($command, @exargs);
if ($usage_string) {
$callback->({data=>[$usage_string]});
$req = {};
return;
}
if (!$noderange) {
$usage_string=xCAT::Usage->getUsage($command);
$callback->({data=>[$usage_string]});
$req = {};
return;
if ($ENV{'XCATBYPASS'}){
my $usage_string=xCAT::Usage->parseCommand($command, @exargs);
if ($usage_string) {
$callback->({data=>[$usage_string]});
$req = {};
return ;
}
if (!$noderange) {
$usage_string="Missing noderange";
$callback->({data=>[$usage_string]});
$req = {};
return ;
}
}
##################################################################
# get the HCPs for the LPARs in order to figure out which service
# nodes to send the requests to
@ -1209,6 +1212,7 @@ sub preprocess_request {
#$callback->({data=>["The service node $snkey "]});
my $reqcopy = {%$req};
$reqcopy->{'_xcatdest'} = $snkey;
$reqcopy->{_xcatpreprocessed}->[0] = 1;
my $hcps1=$sn->{$snkey};
my @nodes=();
foreach (@$hcps1) {

View File

@ -1927,7 +1927,9 @@ sub getbladecons {
sub preprocess_request {
my $request = shift;
if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
#if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
if ($request->{_xcatpreprocessed}->[0] == 1 ) { return [$request]; }
my $callback=shift;
my @requests;
@ -1948,7 +1950,8 @@ sub preprocess_request {
}
if (!$noderange) {
$usage_string=xCAT::Usage->getUsage($command);
$usage_string="Missing Noderange\n";
$usage_string .=xCAT::Usage->getUsage($command);
$callback->({data=>$usage_string});
$request = {};
return;
@ -1995,6 +1998,7 @@ sub preprocess_request {
#print "snkey=$snkey\n";
my $reqcopy = {%$request};
$reqcopy->{'_xcatdest'} = $snkey;
$reqcopy->{_xcatpreprocessed}->[0] = 1;
my $mms1=$sn->{$snkey};
my @moreinfo=();
my @nodes=();