From: Johannes Meyer Date: Tue, 17 Dec 2013 08:50:19 +0000 (+0100) Subject: Fix address and address6 being empty in objects.cache X-Git-Tag: v0.0.6~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1bec9692c688f43c043e15f299ad3d3aa16f750d;p=icinga2 Fix address and address6 being empty in objects.cache fixes #5352 --- diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index f1bbb9f4c..1a394867a 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -77,9 +77,11 @@ String CompatUtility::GetHostAddress(const Host::Ptr& host) String address; - if (macros) { + if (macros) address = macros->Get("address"); - } + + if (address.IsEmpty()) + address = host->GetName(); return address; } @@ -92,9 +94,11 @@ String CompatUtility::GetHostAddress6(const Host::Ptr& host) String address6; - if (macros) { + if (macros) address6 = macros->Get("address6"); - } + + if (address6.IsEmpty()) + address6 = host->GetName(); return address6; }