Merge pull request #7900 from Icinga/bugfix/icingadb-host_id-missing

IcingaDB: Downtime, Comment, Notification: Add host_id, if object_type is service
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-03-10 10:11:48 +01:00 committed by GitHub
commit 0ea3b48f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -1005,10 +1005,9 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
attributes->Set("command_id", GetObjectIdentifier(notification->GetCommand()));
attributes->Set("host_id", GetObjectIdentifier(host));
if (service)
attributes->Set("service_id", GetObjectIdentifier(service));
else
attributes->Set("host_id", GetObjectIdentifier(host));
TimePeriod::Ptr timeperiod = notification->GetPeriod();
if (timeperiod)
@ -1039,13 +1038,13 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(comment->GetCheckable());
attributes->Set("host_id", GetObjectIdentifier(host));
if (service) {
attributes->Set("object_type", "service");
attributes->Set("service_id", GetObjectIdentifier(service));
} else {
} else
attributes->Set("object_type", "host");
attributes->Set("host_id", GetObjectIdentifier(host));
}
auto expireTime (comment->GetExpireTime());
@ -1076,13 +1075,12 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
Service::Ptr service;
tie(host, service) = GetHostService(downtime->GetCheckable());
attributes->Set("host_id", GetObjectIdentifier(host));
if (service) {
attributes->Set("object_type", "service");
attributes->Set("service_id", GetObjectIdentifier(service));
} else {
} else
attributes->Set("object_type", "host");
attributes->Set("host_id", GetObjectIdentifier(host));
}
auto triggeredBy (Downtime::GetByName(downtime->GetTriggeredBy()));
if (triggeredBy) {