Skip to content

Commit

Permalink
Merge pull request #8706 from Icinga/bugfix/icingadb-endpoint-zone
Browse files Browse the repository at this point in the history
Icinga DB: dump the correct icinga:config:endpoint#zone_id
  • Loading branch information
Al2Klimov authored Apr 26, 2021
2 parents 52c8444 + 7dcf48f commit 7f5225e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/icingadb/icingadb-objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,14 +1088,20 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
attributes->Set("environment_id", m_EnvironmentId);
attributes->Set("name", object->GetName());

Zone::Ptr ObjectsZone = static_pointer_cast<Zone>(object->GetZone());
Zone::Ptr ObjectsZone;
Type::Ptr type = object->GetReflectionType();

if (type == Endpoint::TypeInstance) {
ObjectsZone = static_cast<Endpoint*>(object.get())->GetZone();
} else {
ObjectsZone = static_pointer_cast<Zone>(object->GetZone());
}

if (ObjectsZone) {
attributes->Set("zone_id", GetObjectIdentifier(ObjectsZone));
attributes->Set("zone", ObjectsZone->GetName());
}

Type::Ptr type = object->GetReflectionType();

if (type == Endpoint::TypeInstance) {
return true;
}
Expand Down

0 comments on commit 7f5225e

Please sign in to comment.