]> granicus.if.org Git - icinga2/commitdiff
Better signal for checking the cluster config sync stage (ignore production)
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 27 Sep 2018 16:19:48 +0000 (18:19 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 19 Jun 2019 12:46:11 +0000 (14:46 +0200)
lib/cli/daemonutility.cpp
lib/remote/apilistener-filesync.cpp

index b586544ee3fdf371564787b61309a00b2bb1286a..802f1e758d3902a007f7da1670db6de115824c50 100644 (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));
index 68b96b9df3de6e4dc77e54aaf278e051fd072dbe..f1d5902939e5fb396f5263b83b653ec989355dad 100644 (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));