]> granicus.if.org Git - icinga2/blobdiff - lib/icinga/checkable.cpp
Fix compiler warnings w/ config validators
[icinga2] / lib / icinga / checkable.cpp
index 27b5c3628537cac82d9a9233b33060c99b154078..6ec3294c3c8842b27af3bdb5c701e0dd113cd2d3 100644 (file)
@@ -18,6 +18,9 @@
  ******************************************************************************/
 
 #include "icinga/checkable.hpp"
+#include "icinga/checkable.tcpp"
+#include "icinga/host.hpp"
+#include "icinga/service.hpp"
 #include "base/objectlock.hpp"
 #include "base/utility.hpp"
 #include "base/exception.hpp"
@@ -80,7 +83,13 @@ void Checkable::AddGroup(const String& name)
 {
        boost::mutex::scoped_lock lock(m_CheckableMutex);
 
-       Array::Ptr groups = GetGroups();
+       Array::Ptr groups;
+       Host *host = dynamic_cast<Host *>(this);
+
+       if (host)
+               groups = host->GetGroups();
+       else
+               groups = static_cast<Service *>(this)->GetGroups();
 
        if (groups && groups->Contains(name))
                return;