mirror of https://github.com/Icinga/icinga2.git
Prevent calls to command API while the configuration is reloading.
Fixes #9840
This commit is contained in:
parent
7ae91ce504
commit
41e21cb8cf
|
@ -1,5 +1,6 @@
|
||||||
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
||||||
|
|
||||||
|
#include "remote/configobjectslock.hpp"
|
||||||
#include "remote/consolehandler.hpp"
|
#include "remote/consolehandler.hpp"
|
||||||
#include "remote/httputility.hpp"
|
#include "remote/httputility.hpp"
|
||||||
#include "remote/filterutility.hpp"
|
#include "remote/filterutility.hpp"
|
||||||
|
@ -88,6 +89,13 @@ bool ConsoleHandler::HandleRequest(
|
||||||
|
|
||||||
bool sandboxed = HttpUtility::GetLastParameter(params, "sandboxed");
|
bool sandboxed = HttpUtility::GetLastParameter(params, "sandboxed");
|
||||||
|
|
||||||
|
ConfigObjectsSharedLock lock (std::try_to_lock);
|
||||||
|
|
||||||
|
if (!lock) {
|
||||||
|
HttpUtility::SendJsonError(response, params, 503, "Icinga is reloading.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (methodName == "execute-script")
|
if (methodName == "execute-script")
|
||||||
return ExecuteScriptHelper(request, response, params, command, session, sandboxed);
|
return ExecuteScriptHelper(request, response, params, command, session, sandboxed);
|
||||||
else if (methodName == "auto-complete-script")
|
else if (methodName == "auto-complete-script")
|
||||||
|
|
Loading…
Reference in New Issue