"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/remote/configpackageutility.cpp" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

configpackageutility.cpp  (icinga2-2.11.5):configpackageutility.cpp  (icinga2-2.12.0)
skipping to change at line 174 skipping to change at line 174
fp.close(); fp.close();
} }
void ConfigPackageUtility::ActivateStage(const String& packageName, const String & stageName) void ConfigPackageUtility::ActivateStage(const String& packageName, const String & stageName)
{ {
SetActiveStage(packageName, stageName); SetActiveStage(packageName, stageName);
WritePackageConfig(packageName); WritePackageConfig(packageName);
} }
void ConfigPackageUtility::TryActivateStageCallback(const ProcessResult& pr, con st String& packageName, const String& stageName, bool reload) void ConfigPackageUtility::TryActivateStageCallback(const ProcessResult& pr, con st String& packageName, const String& stageName, bool activate, bool reload)
{ {
String logFile = GetPackageDir() + "/" + packageName + "/" + stageName + "/startup.log"; String logFile = GetPackageDir() + "/" + packageName + "/" + stageName + "/startup.log";
std::ofstream fpLog(logFile.CStr(), std::ofstream::out | std::ostream::bi nary | std::ostream::trunc); std::ofstream fpLog(logFile.CStr(), std::ofstream::out | std::ostream::bi nary | std::ostream::trunc);
fpLog << pr.Output; fpLog << pr.Output;
fpLog.close(); fpLog.close();
String statusFile = GetPackageDir() + "/" + packageName + "/" + stageName + "/status"; String statusFile = GetPackageDir() + "/" + packageName + "/" + stageName + "/status";
std::ofstream fpStatus(statusFile.CStr(), std::ofstream::out | std::ostre am::binary | std::ostream::trunc); std::ofstream fpStatus(statusFile.CStr(), std::ofstream::out | std::ostre am::binary | std::ostream::trunc);
fpStatus << pr.ExitStatus; fpStatus << pr.ExitStatus;
fpStatus.close(); fpStatus.close();
/* validation went fine, activate stage and reload */ /* validation went fine, activate stage and reload */
if (pr.ExitStatus == 0) { if (pr.ExitStatus == 0) {
{ if (activate) {
boost::mutex::scoped_lock lock(GetStaticPackageMutex()); {
boost::mutex::scoped_lock lock(GetStaticPackageMu
tex());
ActivateStage(packageName, stageName); ActivateStage(packageName, stageName);
} }
if (reload) if (reload)
Application::RequestRestart(); Application::RequestRestart();
}
} else { } else {
Log(LogCritical, "ConfigPackageUtility") Log(LogCritical, "ConfigPackageUtility")
<< "Config validation failed for package '" << "Config validation failed for package '"
<< packageName << "' and stage '" << stageName << "'."; << packageName << "' and stage '" << stageName << "'.";
} }
} }
void ConfigPackageUtility::AsyncTryActivateStage(const String& packageName, cons t String& stageName, bool reload) void ConfigPackageUtility::AsyncTryActivateStage(const String& packageName, cons t String& stageName, bool activate, bool reload)
{ {
VERIFY(Application::GetArgC() >= 1); VERIFY(Application::GetArgC() >= 1);
// prepare arguments // prepare arguments
Array::Ptr args = new Array({ Array::Ptr args = new Array({
Application::GetExePath(Application::GetArgV()[0]), Application::GetExePath(Application::GetArgV()[0]),
}); });
// copy all arguments of parent process // copy all arguments of parent process
for (int i = 1; i < Application::GetArgC(); i++) { for (int i = 1; i < Application::GetArgC(); i++) {
skipping to change at line 229 skipping to change at line 231
args->Add(argV); args->Add(argV);
} }
// add arguments for validation // add arguments for validation
args->Add("--validate"); args->Add("--validate");
args->Add("--define"); args->Add("--define");
args->Add("ActiveStageOverride=" + packageName + ":" + stageName); args->Add("ActiveStageOverride=" + packageName + ":" + stageName);
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(std::bind(&TryActivateStageCallback, _1, packageName, stageN ame, reload)); process->Run(std::bind(&TryActivateStageCallback, _1, packageName, stageN ame, activate, reload));
} }
void ConfigPackageUtility::DeleteStage(const String& packageName, const String& stageName) void ConfigPackageUtility::DeleteStage(const String& packageName, const String& stageName)
{ {
String path = GetPackageDir() + "/" + packageName + "/" + stageName; String path = GetPackageDir() + "/" + packageName + "/" + stageName;
if (!Utility::PathExists(path)) if (!Utility::PathExists(path))
BOOST_THROW_EXCEPTION(std::invalid_argument("Stage does not exist .")); BOOST_THROW_EXCEPTION(std::invalid_argument("Stage does not exist ."));
if (GetActiveStage(packageName) == stageName) if (GetActiveStage(packageName) == stageName)
 End of changes. 6 change blocks. 
9 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)