Merge pull request #8547 from Icinga/bugfix/unable-to-toggle-notifications-from-icingaweb2-8533

Fix runtime config updates not working for objects without zone
This commit is contained in:
Alexander Aleksandrovič Klimov 2021-03-26 17:18:22 +01:00 committed by GitHub
commit ee705bb110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -74,7 +74,7 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
String objZone = params->Get("zone"); String objZone = params->Get("zone");
if (!Zone::GetByName(objZone)) { if (!objZone.IsEmpty() && !Zone::GetByName(objZone)) {
Log(LogNotice, "ApiListener") Log(LogNotice, "ApiListener")
<< "Discarding 'config update object' message" << "Discarding 'config update object' message"
<< " from '" << identity << "' (endpoint: '" << endpoint->GetName() << "', zone: '" << endpointZone->GetName() << "')" << " from '" << identity << "' (endpoint: '" << endpoint->GetName() << "', zone: '" << endpointZone->GetName() << "')"
@ -325,7 +325,11 @@ void ApiListener::UpdateConfigObject(const ConfigObject::Ptr& object, const Mess
params->Set("name", object->GetName()); params->Set("name", object->GetName());
params->Set("type", object->GetReflectionType()->GetName()); params->Set("type", object->GetReflectionType()->GetName());
params->Set("version", object->GetVersion()); params->Set("version", object->GetVersion());
params->Set("zone", object->GetZoneName());
String zoneName = object->GetZoneName();
if (!zoneName.IsEmpty())
params->Set("zone", zoneName);
if (object->GetPackage() == "_api") { if (object->GetPackage() == "_api") {
String file; String file;