mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 15:44:11 +02:00
Don't accept config updates for zones for which we have an authoritative copy of the config
fixes #8555
This commit is contained in:
parent
3046ad5d5e
commit
4e16f48255
@ -31,7 +31,7 @@ using namespace icinga;
|
|||||||
|
|
||||||
REGISTER_APIFUNCTION(Update, config, &ApiListener::ConfigUpdateHandler);
|
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();
|
String path = Application::GetZonesDir() + "/" + zone->GetName();
|
||||||
return Utility::PathExists(path);
|
return Utility::PathExists(path);
|
||||||
@ -233,7 +233,13 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin& origin, const Dictio
|
|||||||
|
|
||||||
if (!zone) {
|
if (!zone) {
|
||||||
Log(LogWarning, "ApiListener")
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ private:
|
|||||||
void SyncZoneDirs(void) const;
|
void SyncZoneDirs(void) const;
|
||||||
void SyncZoneDir(const Zone::Ptr& zone) 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);
|
static void ConfigGlobHandler(Dictionary::Ptr& config, const String& path, const String& file);
|
||||||
void SendConfigUpdate(const ApiClient::Ptr& aclient);
|
void SendConfigUpdate(const ApiClient::Ptr& aclient);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user