Don't accept config updates for zones for which we have an authoritative copy of the config

fixes #8555
This commit is contained in:
Gunnar Beutner 2015-03-09 08:43:46 +01:00
parent 3046ad5d5e
commit 4e16f48255
2 changed files with 9 additions and 3 deletions

View File

@ -31,7 +31,7 @@ using namespace icinga;
REGISTER_APIFUNCTION(Update, config, &ApiListener::ConfigUpdateHandler);
bool ApiListener::IsConfigMaster(const Zone::Ptr& zone) const
bool ApiListener::IsConfigMaster(const Zone::Ptr& zone)
{
String path = Application::GetZonesDir() + "/" + zone->GetName();
return Utility::PathExists(path);
@ -233,7 +233,13 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin& origin, const Dictio
if (!zone) {
Log(LogWarning, "ApiListener")
<< "Ignoring config update for unknown zone: " << kv.first;
<< "Ignoring config update for unknown zone '" << kv.first << "'.";
continue;
}
if (IsConfigMaster(zone)) {
Log(LogWarning, "ApiListener")
<< "Ignoring config update for zone '" << kv.first << "' because we have an authoritative version of the zone's config.";
continue;
}

View File

@ -110,7 +110,7 @@ private:
void SyncZoneDirs(void) const;
void SyncZoneDir(const Zone::Ptr& zone) const;
bool IsConfigMaster(const Zone::Ptr& zone) const;
static bool IsConfigMaster(const Zone::Ptr& zone);
static void ConfigGlobHandler(Dictionary::Ptr& config, const String& path, const String& file);
void SendConfigUpdate(const ApiClient::Ptr& aclient);
};