mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
API filesync: wait for validation process to exit
This avoid having to pass a lock implictly using the captured variables of a lambda.
This commit is contained in:
parent
fde51ed9f7
commit
3081d9942d
@ -544,7 +544,7 @@ void ApiListener::HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dic
|
|||||||
Log(LogInformation, "ApiListener")
|
Log(LogInformation, "ApiListener")
|
||||||
<< "Received configuration updates (" << count << ") from endpoint '" << fromEndpointName
|
<< "Received configuration updates (" << count << ") from endpoint '" << fromEndpointName
|
||||||
<< "' are different to production, triggering validation and reload.";
|
<< "' are different to production, triggering validation and reload.";
|
||||||
AsyncTryActivateZonesStage(relativePaths, lock);
|
AsyncTryActivateZonesStage(relativePaths);
|
||||||
} else {
|
} else {
|
||||||
Log(LogInformation, "ApiListener")
|
Log(LogInformation, "ApiListener")
|
||||||
<< "Received configuration updates (" << count << ") from endpoint '" << fromEndpointName
|
<< "Received configuration updates (" << count << ") from endpoint '" << fromEndpointName
|
||||||
@ -634,7 +634,7 @@ void ApiListener::TryActivateZonesStageCallback(const ProcessResult& pr,
|
|||||||
*
|
*
|
||||||
* @param relativePaths Required for later file operations in the callback. Provides the zone name plus path in a list.
|
* @param relativePaths Required for later file operations in the callback. Provides the zone name plus path in a list.
|
||||||
*/
|
*/
|
||||||
void ApiListener::AsyncTryActivateZonesStage(const std::vector<String>& relativePaths, const Shared<std::unique_lock<SpinLock>>::Ptr& lock)
|
void ApiListener::AsyncTryActivateZonesStage(const std::vector<String>& relativePaths)
|
||||||
{
|
{
|
||||||
VERIFY(Application::GetArgC() >= 1);
|
VERIFY(Application::GetArgC() >= 1);
|
||||||
|
|
||||||
@ -661,9 +661,9 @@ void ApiListener::AsyncTryActivateZonesStage(const std::vector<String>& relative
|
|||||||
Process::Ptr process = new Process(Process::PrepareCommand(args));
|
Process::Ptr process = new Process(Process::PrepareCommand(args));
|
||||||
process->SetTimeout(Application::GetReloadTimeout());
|
process->SetTimeout(Application::GetReloadTimeout());
|
||||||
|
|
||||||
process->Run([relativePaths, lock](const ProcessResult& pr) {
|
process->Run();
|
||||||
TryActivateZonesStageCallback(pr, relativePaths);
|
const ProcessResult& pr = process->WaitForResult();
|
||||||
});
|
TryActivateZonesStageCallback(pr, relativePaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -202,7 +202,7 @@ private:
|
|||||||
|
|
||||||
static void TryActivateZonesStageCallback(const ProcessResult& pr,
|
static void TryActivateZonesStageCallback(const ProcessResult& pr,
|
||||||
const std::vector<String>& relativePaths);
|
const std::vector<String>& relativePaths);
|
||||||
static void AsyncTryActivateZonesStage(const std::vector<String>& relativePaths, const Shared<std::unique_lock<SpinLock>>::Ptr& lock);
|
static void AsyncTryActivateZonesStage(const std::vector<String>& relativePaths);
|
||||||
|
|
||||||
static String GetChecksum(const String& content);
|
static String GetChecksum(const String& content);
|
||||||
static bool CheckConfigChange(const ConfigDirInformation& oldConfig, const ConfigDirInformation& newConfig);
|
static bool CheckConfigChange(const ConfigDirInformation& oldConfig, const ConfigDirInformation& newConfig);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user