Skip to content

Commit

Permalink
Merge pull request #9792 from Icinga/icingadb-conversion-of-strings-t…
Browse files Browse the repository at this point in the history
…o-number-types-to-avoid-crashes-9791

IcingaDB::PrepareObject(): convert non-null Checkable#check_timeout to number
  • Loading branch information
julianbrost authored Jun 26, 2023
2 parents eddd4c7 + 9f08bad commit 5350aa3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/icingadb/icingadb-objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,10 +1272,11 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a

if (type == Host::TypeInstance || type == Service::TypeInstance) {
Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
auto checkTimeout (checkable->GetCheckTimeout());

attributes->Set("checkcommand_name", checkable->GetCheckCommand()->GetName());
attributes->Set("max_check_attempts", checkable->GetMaxCheckAttempts());
attributes->Set("check_timeout", checkable->GetCheckTimeout());
attributes->Set("check_timeout", checkTimeout.IsEmpty() ? checkable->GetCheckCommand()->GetTimeout() : (double)checkTimeout);
attributes->Set("check_interval", checkable->GetCheckInterval());
attributes->Set("check_retry_interval", checkable->GetRetryInterval());
attributes->Set("active_checks_enabled", checkable->GetEnableActiveChecks());
Expand Down

0 comments on commit 5350aa3

Please sign in to comment.