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:
Michael Friedrich 2015-07-26 17:46:47 +02:00
parent fa3d380dff
commit 0a1dad0a8f
3 changed files with 15 additions and 5 deletions

View 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);

View 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);
}
@ -323,3 +320,12 @@ std::vector<ZoneFragment> ConfigCompiler::GetZoneDirs(const String& zone)
else
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);
}

View 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;