2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-21 11:12:04 +00:00

Merge pull request #2639 from immarvin/onretcode

fix issue xcat command returns 0 when cmd fails due authorization #2636
This commit is contained in:
chenglch 2017-03-14 11:32:03 +08:00 committed by GitHub
commit f683826285
2 changed files with 8 additions and 2 deletions

View File

@ -152,7 +152,7 @@ sub preprocess_request
'h|help' => \$::HELP,
'v|version' => \$::VERSION))
{
&usage($cb);
&usage($cb,1);
return (1);
}
if ($::HELP) {
@ -169,7 +169,7 @@ sub preprocess_request
my $nodes = $req->{node};
if (!$nodes)
{
&usage($cb);
&usage($cb,1);
return (1);
}
@ -914,6 +914,7 @@ sub process_request {
}
if ($command eq "nodestat_internal") {
#if ( -x '/usr/bin/nmap' ) {
@ -1210,10 +1211,14 @@ sub process_request {
sub usage
{
my $cb = shift;
my $retcode=shift;
my $rsp = {};
$rsp->{data}->[0] = "Usage:";
$rsp->{data}->[1] = " nodestat [noderange] [-m|--usemon] [-p|powerstat] [-u|--updatedb]";
$rsp->{data}->[2] = " nodestat [-h|--help|-v|--version]";
if($retcode){
$rsp->{errorcode}->[0]=$retcode;
}
xCAT::MsgUtils->message("I", $rsp, $cb);
}

View File

@ -2843,6 +2843,7 @@ sub service_connection {
}
} else {
my %resp = (error => "Permission denied for request");
$resp{errorcode}=1;
$resp{serverdone} = [undef];
if ($req->{transid}) {
$resp{transid} = $req->{transid}->[0];