mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 09:13:08 +00:00
use msgsource directly
This commit is contained in:
parent
25bede4130
commit
e80509c0ae
@ -1129,12 +1129,15 @@ sub handle_response {
|
||||
return;
|
||||
}
|
||||
|
||||
my $msgsource;
|
||||
my $msgsource = "";
|
||||
if ($ENV{'XCATSHOWSVR'}) {
|
||||
unless ($rsp->{NoSvrPrefix}) { # some plugins could disable the prefix forcely by seting the flag in response.
|
||||
$msgsource = $rsp->{xcatdsource}->[0] if ($rsp->{xcatdsource});
|
||||
}
|
||||
}
|
||||
if ($rsp->{host}) {
|
||||
$msgsource = $rsp->{xcatdsource}->[0] if ($rsp->{xcatdsource});
|
||||
}
|
||||
|
||||
#print "in handle_response\n";
|
||||
# Handle errors
|
||||
@ -1148,10 +1151,6 @@ sub handle_response {
|
||||
$xCAT::Client::EXITCODE |= $rsp->{errorcode};
|
||||
} # assume it is a non-reference scalar
|
||||
}
|
||||
my $host = "";
|
||||
if ($rsp->{host}) {
|
||||
$host = "[".$rsp->{host}->[0]."]" if !$msgsource;
|
||||
}
|
||||
|
||||
if ($rsp->{error}) {
|
||||
|
||||
@ -1160,14 +1159,14 @@ sub handle_response {
|
||||
foreach my $text (@{ $rsp->{error} }) {
|
||||
my $desc = "$text";
|
||||
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
|
||||
$desc = "Error$host: $desc" unless ($rsp->{NoErrorPrefix});
|
||||
$desc = "Error: $desc" unless ($rsp->{NoErrorPrefix});
|
||||
print STDERR "$desc\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
my $desc = $rsp->{error};
|
||||
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
|
||||
$desc = "Error$host: $desc" unless ($rsp->{NoErrorPrefix});
|
||||
$desc = "Error: $desc" unless ($rsp->{NoErrorPrefix});
|
||||
print STDERR "$desc\n";
|
||||
}
|
||||
}
|
||||
@ -1178,14 +1177,14 @@ sub handle_response {
|
||||
foreach my $text (@{ $rsp->{warning} }) {
|
||||
my $desc = "$text";
|
||||
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
|
||||
$desc = "Warning$host: $desc" unless ($rsp->{NoWarnPrefix});
|
||||
$desc = "Warning: $desc" unless ($rsp->{NoWarnPrefix});
|
||||
print STDERR "$desc\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
my $desc = $rsp->{warning};
|
||||
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
|
||||
$desc = "Warning$host: $desc" unless ($rsp->{NoWarnPrefix});
|
||||
$desc = "Warning: $desc" unless ($rsp->{NoWarnPrefix});
|
||||
print STDERR "$desc\n";
|
||||
}
|
||||
}
|
||||
@ -1193,7 +1192,7 @@ sub handle_response {
|
||||
#print "printing info\n";
|
||||
if (ref($rsp->{info}) eq 'ARRAY') {
|
||||
foreach my $text (@{ $rsp->{info} }) {
|
||||
my $desc = "$host$text";
|
||||
my $desc = "$text";
|
||||
$desc = "[$msgsource]: $desc" if ($msgsource && $desc);
|
||||
print "$desc\n";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user