2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

check if agent exists in process_request and give more clear message.

This commit is contained in:
Bin Xu 2018-03-09 14:56:22 +08:00
parent c38df296d9
commit 6d3d340849
2 changed files with 11 additions and 4 deletions

View File

@ -69,11 +69,14 @@ sub acquire_lock {
flock($lock_fd, LOCK_EX) or return undef;
return $lock_fd;
}
sub start_python_agent {
if (! -e $PYTHON_AGENT_FILE) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: '$PYTHON_AGENT_FILE' does not exist");
return undef;
sub exists_python_agent {
if ( -e $PYTHON_AGENT_FILE) {
return 1;
}
return 0;
}
sub start_python_agent {
if (!defined(acquire_lock())) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Failed to acquire lock");

View File

@ -117,6 +117,10 @@ sub process_request {
my $request = shift;
$callback = shift;
if (!xCAT::OPENBMC::exists_python_agent()) {
xCAT::MsgUtils->message("E", { data => ["The xCAT Python agent does not exist. Check if xCAT-openbmc-py package is installed on management node and service nodes."] }, $callback);
return;
}
# If we can't start the python agent, exit immediately
my $pid = xCAT::OPENBMC::start_python_agent();
if (!defined($pid)) {