2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-21 05:25:32 +00:00

Check that RC is 200 to prevent unknown issues, handle the response generically

This commit is contained in:
Victor Hu
2017-11-30 15:43:08 -05:00
parent adee11eee9
commit b934d44e0c

View File

@ -441,6 +441,7 @@ $::RESPONSE_OK = "200 OK";
$::RESPONSE_SERVER_ERROR = "500 Internal Server Error";
$::RESPONSE_SERVICE_UNAVAILABLE = "503 Service Unavailable";
$::RESPONSE_FORBIDDEN = "403 Forbidden";
$::RESPONSE_NOT_FOUND = "404 Not Found";
$::RESPONSE_METHOD_NOT_ALLOWED = "405 Method Not Allowed";
$::RESPONSE_SERVICE_TIMEOUT = "504 Gateway Timeout";
@ -1843,7 +1844,9 @@ sub login_request {
my $login_request = HTTP::Request->new( 'POST', $login_url, $header, $data );
my $login_response = $brower->request($login_request);
if ($login_response->status_line =~ /500 Can't connect to/ or $login_response->status_line =~ /500 read timeout/) {
# 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);
return 1;
}