{
String etcPath = Application::GetZonesDir() + "/" + Utility::BaseName(zonePath);
- if (Utility::PathExists(etcPath))
+ if (Utility::PathExists(etcPath) || Utility::PathExists(zonePath + "/.authoritative"))
return;
IncludeZoneDirRecursive(zonePath);
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;
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;
}
Dictionary::Ptr newConfig = LoadConfigDir(newDir);
Dictionary::Ptr oldConfig = LoadConfigDir(oldDir);
- UpdateConfigDir(oldConfig, newConfig, oldDir);
+ UpdateConfigDir(oldConfig, newConfig, oldDir, true);
}
void ApiListener::SyncZoneDirs(void) const
Dictionary::Ptr newConfig = kv.second;
Dictionary::Ptr oldConfig = LoadConfigDir(oldDir);
- if (UpdateConfigDir(oldConfig, newConfig, oldDir))
+ if (UpdateConfigDir(oldConfig, newConfig, oldDir, false))
configChange = true;
}
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;