Skip to content

Commit 7f5225e

Browse files
authored
Merge pull request #8706 from Icinga/bugfix/icingadb-endpoint-zone
Icinga DB: dump the correct icinga:config:endpoint#zone_id
2 parents 52c8444 + 7dcf48f commit 7f5225e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/icingadb/icingadb-objects.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,14 +1088,20 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
10881088
attributes->Set("environment_id", m_EnvironmentId);
10891089
attributes->Set("name", object->GetName());
10901090

1091-
Zone::Ptr ObjectsZone = static_pointer_cast<Zone>(object->GetZone());
1091+
Zone::Ptr ObjectsZone;
1092+
Type::Ptr type = object->GetReflectionType();
1093+
1094+
if (type == Endpoint::TypeInstance) {
1095+
ObjectsZone = static_cast<Endpoint*>(object.get())->GetZone();
1096+
} else {
1097+
ObjectsZone = static_pointer_cast<Zone>(object->GetZone());
1098+
}
1099+
10921100
if (ObjectsZone) {
10931101
attributes->Set("zone_id", GetObjectIdentifier(ObjectsZone));
10941102
attributes->Set("zone", ObjectsZone->GetName());
10951103
}
10961104

1097-
Type::Ptr type = object->GetReflectionType();
1098-
10991105
if (type == Endpoint::TypeInstance) {
11001106
return true;
11011107
}

0 commit comments

Comments
 (0)