mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 17:23:08 +00:00
Improve the message on the HTTP response
This commit is contained in:
parent
f912458bdc
commit
5bf6e1dc83
@ -1752,8 +1752,10 @@ sub deal_with_response {
|
||||
$error = $::RESPONSE_SERVICE_TIMEOUT;
|
||||
} else {
|
||||
my $response_info = decode_json $response->content;
|
||||
# Handle 500
|
||||
if ($response->status_line eq $::RESPONSE_SERVER_ERROR) {
|
||||
$error = $response_info->{'data'}->{'exception'};
|
||||
$error = "[" . $response->code . "] " . $response_info->{'data'}->{'exception'};
|
||||
# Handle 403
|
||||
} elsif ($response->status_line eq $::RESPONSE_FORBIDDEN) {
|
||||
#
|
||||
# For any invalid data that we can detect, provide a better response message
|
||||
@ -1764,21 +1766,21 @@ sub deal_with_response {
|
||||
} elsif ($node_info{$node}{cur_status} eq "RSETBOOT_ENABLE_RESPONSE" ) {
|
||||
# If 403 is received setting boot method, API endpoint changed in 1738 FW, inform the user of work around.
|
||||
$error = "Invalid endpoint used to set boot method. If running firmware < ibm-v1.99.10-0-r7, 'export XCAT_OPENBMC_FIRMWARE=1736' and retry.";
|
||||
|
||||
} else {
|
||||
$error = "$::RESPONSE_FORBIDDEN - Requested endpoint does not exists and may indicate function is not yet supported by OpenBMC firmware.";
|
||||
}
|
||||
} elsif ($response_info->{'data'}->{'description'} =~ /path or object not found: (.+)/) {
|
||||
# Handle 404
|
||||
} elsif ($response->status_line eq $::RESPONSE_NOT_FOUND) {
|
||||
#
|
||||
# For any invalid data that we can detect, provide a better response message
|
||||
#
|
||||
if ($node_info{$node}{cur_status} eq "RFLASH_DELETE_IMAGE_RESPONSE") {
|
||||
$error = "Invalid ID provided to delete. Use the -l option to view valid firmware IDs.";
|
||||
} else {
|
||||
$error = "Path or object not found: $1";
|
||||
$error = "[" . $response->code . "] Path or object not found: $1";
|
||||
}
|
||||
} else {
|
||||
$error = $response_info->{'data'}->{'description'};
|
||||
$error = "[" . $response->code . "] " . $response_info->{'data'}->{'description'};
|
||||
}
|
||||
}
|
||||
xCAT::SvrUtils::sendmsg([1, $error], $callback, $node);
|
||||
@ -1852,7 +1854,7 @@ sub login_request {
|
||||
# Check the return code
|
||||
if ($login_response->code != 200) {
|
||||
# handle the errors generically
|
||||
xCAT::SvrUtils::sendmsg([1 ,"Login to BMC failed. Status: " . $login_response->status_line . "."], $callback, $node);
|
||||
xCAT::SvrUtils::sendmsg([1 ,"[" . $login_response->code . "] Login to BMC failed: " . $login_response->status_line . "."], $callback, $node);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user