]> granicus.if.org Git - icinga2/commitdiff
Fix address and address6 being empty in objects.cache
authorJohannes Meyer <johannes.meyer@netways.de>
Tue, 17 Dec 2013 08:50:19 +0000 (09:50 +0100)
committerJohannes Meyer <johannes.meyer@netways.de>
Tue, 17 Dec 2013 08:50:19 +0000 (09:50 +0100)
fixes #5352

lib/icinga/compatutility.cpp

index f1bbb9f4cd522f04836c1e32fe167b076e43d454..1a394867ab50fa7a5a79940523100568db92130e 100644 (file)
@@ -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;
 }