mirror of https://github.com/Icinga/icinga2.git
parent
9c9982616b
commit
7b8dc1d97e
|
@ -282,7 +282,7 @@ mainloop:
|
||||||
|
|
||||||
lastLoop = now;
|
lastLoop = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_RequestRestart) {
|
if (m_RequestRestart) {
|
||||||
m_RequestRestart = false; // we are now handling the request, once is enough
|
m_RequestRestart = false; // we are now handling the request, once is enough
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ mainloop:
|
||||||
|
|
||||||
goto mainloop;
|
goto mainloop;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogInformation, "Application", "Shutting down Icinga...");
|
Log(LogInformation, "Application", "Shutting down Icinga...");
|
||||||
DynamicObject::StopObjects();
|
DynamicObject::StopObjects();
|
||||||
Application::GetInstance()->OnShutdown();
|
Application::GetInstance()->OnShutdown();
|
||||||
|
@ -342,7 +342,7 @@ pid_t Application::StartReloadProcess(void)
|
||||||
Process::Ptr process = make_shared<Process>(Process::PrepareCommand(args));
|
Process::Ptr process = make_shared<Process>(Process::PrepareCommand(args));
|
||||||
process->SetTimeout(300);
|
process->SetTimeout(300);
|
||||||
process->Run(&ReloadProcessCallback);
|
process->Run(&ReloadProcessCallback);
|
||||||
|
|
||||||
return process->GetPID();
|
return process->GetPID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,6 +1009,7 @@ void Application::MakeVariablesConstant(void)
|
||||||
ScriptVariable::GetByName("PrefixDir")->SetConstant(true);
|
ScriptVariable::GetByName("PrefixDir")->SetConstant(true);
|
||||||
ScriptVariable::GetByName("SysconfDir")->SetConstant(true);
|
ScriptVariable::GetByName("SysconfDir")->SetConstant(true);
|
||||||
ScriptVariable::GetByName("LocalStateDir")->SetConstant(true);
|
ScriptVariable::GetByName("LocalStateDir")->SetConstant(true);
|
||||||
|
ScriptVariable::GetByName("RunDir")->SetConstant(true);
|
||||||
ScriptVariable::GetByName("PkgDataDir")->SetConstant(true);
|
ScriptVariable::GetByName("PkgDataDir")->SetConstant(true);
|
||||||
ScriptVariable::GetByName("StatePath")->SetConstant(false);
|
ScriptVariable::GetByName("StatePath")->SetConstant(false);
|
||||||
ScriptVariable::GetByName("PidPath")->SetConstant(false);
|
ScriptVariable::GetByName("PidPath")->SetConstant(false);
|
||||||
|
|
|
@ -898,6 +898,12 @@ void ApiEvents::RepositoryTimerHandler(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
Endpoint::Ptr my_endpoint = Endpoint::GetLocalEndpoint();
|
Endpoint::Ptr my_endpoint = Endpoint::GetLocalEndpoint();
|
||||||
|
|
||||||
|
if (!my_endpoint) {
|
||||||
|
Log(LogWarning, "ApiEvents", "No local endpoint defined. Bailing out.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Zone::Ptr my_zone = my_endpoint->GetZone();
|
Zone::Ptr my_zone = my_endpoint->GetZone();
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
|
@ -965,14 +971,26 @@ Value ApiEvents::UpdateRepositoryAPIHandler(const MessageOrigin& origin, const D
|
||||||
String ApiEvents::GetVirtualHostName(const Host::Ptr& host)
|
String ApiEvents::GetVirtualHostName(const Host::Ptr& host)
|
||||||
{
|
{
|
||||||
String host_name = host->GetName();
|
String host_name = host->GetName();
|
||||||
if (host_name == "localhost")
|
if (host_name == "localhost") {
|
||||||
host_name = Endpoint::GetLocalEndpoint()->GetName();
|
Endpoint::Ptr local = Endpoint::GetLocalEndpoint();
|
||||||
|
|
||||||
|
if (!local)
|
||||||
|
return Empty;
|
||||||
|
|
||||||
|
host_name = local->GetName();
|
||||||
|
}
|
||||||
|
|
||||||
return host_name;
|
return host_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Host::Ptr ApiEvents::FindHostByVirtualName(const String& hostName)
|
Host::Ptr ApiEvents::FindHostByVirtualName(const String& hostName)
|
||||||
{
|
{
|
||||||
if (hostName == Endpoint::GetLocalEndpoint()->GetName())
|
Endpoint::Ptr local = Endpoint::GetLocalEndpoint();
|
||||||
|
|
||||||
|
if (!local)
|
||||||
|
return Host::Ptr();
|
||||||
|
|
||||||
|
if (hostName == local->GetName())
|
||||||
return Host::GetByName("localhost");
|
return Host::GetByName("localhost");
|
||||||
else
|
else
|
||||||
return Host::GetByName(hostName);
|
return Host::GetByName(hostName);
|
||||||
|
|
Loading…
Reference in New Issue