Make sure we don't include zones.d directories for zones which were removed

fixes #8256
This commit is contained in:
Gunnar Beutner 2015-01-20 13:18:40 +01:00
parent c29c11c15b
commit 310278344c
3 changed files with 13 additions and 5 deletions

View File

@ -90,7 +90,7 @@ static void IncludeNonLocalZone(const String& zonePath)
{
String etcPath = Application::GetZonesDir() + "/" + Utility::BaseName(zonePath);
if (Utility::PathExists(etcPath))
if (Utility::PathExists(etcPath) || Utility::PathExists(zonePath + "/.authoritative"))
return;
IncludeZoneDirRecursive(zonePath);

View File

@ -58,7 +58,7 @@ Dictionary::Ptr ApiListener::LoadConfigDir(const String& dir)
return config;
}
bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictionary::Ptr& newConfig, const String& configDir)
bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictionary::Ptr& newConfig, const String& configDir, bool authoritative)
{
bool configChange = false;
@ -103,6 +103,14 @@ bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictio
fp.close();
}
if (authoritative) {
String authPath = configDir + "/.authoritative";
if (!Utility::PathExists(tsPath)) {
std::ofstream fp(tsPath.CStr(), std::ofstream::out | std::ostream::trunc);
fp.close();
}
}
return configChange;
}
@ -127,7 +135,7 @@ void ApiListener::SyncZoneDir(const Zone::Ptr& zone) const
Dictionary::Ptr newConfig = LoadConfigDir(newDir);
Dictionary::Ptr oldConfig = LoadConfigDir(oldDir);
UpdateConfigDir(oldConfig, newConfig, oldDir);
UpdateConfigDir(oldConfig, newConfig, oldDir, true);
}
void ApiListener::SyncZoneDirs(void) const
@ -239,7 +247,7 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin& origin, const Dictio
Dictionary::Ptr newConfig = kv.second;
Dictionary::Ptr oldConfig = LoadConfigDir(oldDir);
if (UpdateConfigDir(oldConfig, newConfig, oldDir))
if (UpdateConfigDir(oldConfig, newConfig, oldDir, false))
configChange = true;
}

View File

@ -103,7 +103,7 @@ private:
void ReplayLog(const ApiClient::Ptr& client);
static Dictionary::Ptr LoadConfigDir(const String& dir);
static bool UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictionary::Ptr& newConfig, const String& configDir);
static bool UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictionary::Ptr& newConfig, const String& configDir, bool authoritative);
void SyncZoneDirs(void) const;
void SyncZoneDir(const Zone::Ptr& zone) const;