Send check result even when accept_commands is not set

fixes #8333
This commit is contained in:
Gunnar Beutner 2015-02-05 15:17:56 +01:00
parent 4896428c06
commit 2d5112c878
1 changed files with 15 additions and 0 deletions

View File

@ -1525,6 +1525,21 @@ Value ApiEvents::ExecuteCommandAPIHandler(const MessageOrigin& origin, const Dic
if (!listener->GetAcceptCommands()) {
Log(LogWarning, "ApiListener")
<< "Ignoring command. '" << listener->GetName() << "' does not accept commands.";
Host::Ptr host = new Host();
Dictionary::Ptr attrs = new Dictionary();
attrs->Set("__name", params->Get("host"));
attrs->Set("type", "Host");
Deserialize(host, attrs, false, FAConfig);
CheckResult::Ptr cr = new CheckResult();
cr->SetState(ServiceUnknown);
cr->SetOutput("'" + listener->GetName() + "' does not accept commands.");
Dictionary::Ptr message = MakeCheckResultMessage(host, cr);
listener->SyncSendMessage(endpoint, message);
return Empty;
}