]> granicus.if.org Git - icinga2/commitdiff
Fix broken cluster config sync w/ latest api changes
authorMichael Friedrich <michael.friedrich@netways.de>
Sun, 26 Jul 2015 15:46:47 +0000 (17:46 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Sun, 26 Jul 2015 15:57:34 +0000 (17:57 +0200)
Apart from dropping the requirement of adding 'include_zones "etc", "zones.d"'
on upgrade to 2.4, we've forgotten to register the local zone directory into
the new ZoneFragment tree.

This fix adds a new function to register the local zones.d directory.
After that the config sync works again.

fixes #9735

lib/cli/daemonutility.cpp
lib/config/configcompiler.cpp
lib/config/configcompiler.hpp

index 4a1f84dad37eb4aff321b52acc83124980aeacaf..ffc680248ce64a09d4211636ff915b7d646ec1f7 100644 (file)
@@ -48,6 +48,9 @@ void IncludeZoneDirRecursive(const String& path, bool& success)
 {
        String zoneName = Utility::BaseName(path);
 
+       /* register this zone path for cluster config sync */
+       ConfigCompiler::RegisterZoneDir("_etc", path, zoneName);
+
        std::vector<Expression *> expressions;
        Utility::GlobRecursive(path, "*.conf", boost::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName), GlobFile);
        DictExpression expr(expressions);
index 80c8850d9935de3848b38666c92454db59a8873d..e9b26fd6bd682d5b188d98197c63c002c122f791 100644 (file)
@@ -177,10 +177,7 @@ void ConfigCompiler::HandleIncludeZone(const String& tag, const String& path, co
        else
                ppath = Utility::DirName(GetPath()) + "/" + path;
 
-       ZoneFragment zf;
-       zf.Tag = tag;
-       zf.Path = ppath;
-       m_ZoneDirs[zoneName].push_back(zf);
+       RegisterZoneDir(tag, ppath, zoneName);
 
        Utility::GlobRecursive(ppath, pattern, boost::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName), GlobFile);
 }
@@ -321,5 +318,14 @@ std::vector<ZoneFragment> ConfigCompiler::GetZoneDirs(const String& zone)
        if (it == m_ZoneDirs.end())
                return std::vector<ZoneFragment>();
        else
-               return it->second; 
+               return it->second;
+}
+
+void ConfigCompiler::RegisterZoneDir(const String& tag, const String& ppath, const String& zoneName)
+{
+       ZoneFragment zf;
+       zf.Tag = tag;
+       zf.Path = ppath;
+       m_ZoneDirs[zoneName].push_back(zf);
 }
+
index e4626758b1edd5791099a67941d47be7eab8fd90..dad82602ec2ced341689152a3a72bf530cb626ed 100644 (file)
@@ -107,6 +107,7 @@ public:
        void *GetScanner(void) const;
 
        static std::vector<ZoneFragment> GetZoneDirs(const String& zone);
+       static void RegisterZoneDir(const String& tag, const String& ppath, const String& zoneName);
 
 private:
        boost::promise<boost::shared_ptr<Expression> > m_Promise;