Better signal for checking the cluster config sync stage (ignore production)

This commit is contained in:
Michael Friedrich 2018-09-27 18:19:48 +02:00
parent 506eee2f7d
commit c2d7063ae7
2 changed files with 13 additions and 6 deletions

View File

@ -100,6 +100,10 @@ static void IncludePackage(const String& packagePath, bool& success)
bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs, const String& objectsFile)
{
bool success;
Namespace::Ptr systemNS = ScriptGlobal::Get("System");
VERIFY(systemNS);
if (!objectsFile.IsEmpty())
ConfigCompilerContext::GetInstance()->OpenObjectsFile(objectsFile);
@ -138,17 +142,20 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
if (!success)
return false;
/* Load cluster synchronized configuration files */
/* Load cluster synchronized configuration files. This can be disabled for staged sync validations. */
bool ignoreZonesVarDir = false;
if (systemNS->Contains("IgnoreZonesVarDir")) {
ignoreZonesVarDir = Convert::ToBool(systemNS->Get("IgnoreZonesVarDir"));
}
String zonesVarDir = Configuration::DataDir + "/api/zones";
if (Utility::PathExists(zonesVarDir))
if (!ignoreZonesVarDir && Utility::PathExists(zonesVarDir))
Utility::Glob(zonesVarDir + "/*", std::bind(&IncludeNonLocalZone, _1, "_cluster", std::ref(success)), GlobDirectory);
if (!success)
return false;
Namespace::Ptr systemNS = ScriptGlobal::Get("System");
VERIFY(systemNS);
/* This is initialized inside the IcingaApplication class. */
Value vAppType;
VERIFY(systemNS->Get("ApplicationType", &vAppType));

View File

@ -391,7 +391,7 @@ void ApiListener::AsyncTryActivateZonesStage(const String& stageConfigDir, const
"daemon",
"--validate",
"--define",
"ZonesDir=" + GetApiZonesStageDir()
"System.IgnoreZonesVarDir=true"
});
Process::Ptr process = new Process(Process::PrepareCommand(args));