mirror of https://github.com/Icinga/icinga2.git
Fix broken cluster config sync w/ latest api changes
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
This commit is contained in:
parent
fa3d380dff
commit
0a1dad0a8f
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue