From c2d7063ae726938c5a1037a77c7fe734a0a71be9 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 27 Sep 2018 18:19:48 +0200 Subject: [PATCH] Better signal for checking the cluster config sync stage (ignore production) --- lib/cli/daemonutility.cpp | 17 ++++++++++++----- lib/remote/apilistener-filesync.cpp | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/cli/daemonutility.cpp b/lib/cli/daemonutility.cpp index b586544ee..802f1e758 100644 --- a/lib/cli/daemonutility.cpp +++ b/lib/cli/daemonutility.cpp @@ -100,6 +100,10 @@ static void IncludePackage(const String& packagePath, bool& success) bool DaemonUtility::ValidateConfigFiles(const std::vector& 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& 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)); diff --git a/lib/remote/apilistener-filesync.cpp b/lib/remote/apilistener-filesync.cpp index 68b96b9df..f1d590293 100644 --- a/lib/remote/apilistener-filesync.cpp +++ b/lib/remote/apilistener-filesync.cpp @@ -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)); -- 2.40.0