]> granicus.if.org Git - icinga2/commitdiff
Revert "DB IDO: Add endpoint id to history tables, part 1."
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 20 Mar 2014 14:29:22 +0000 (15:29 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 20 Mar 2014 17:03:47 +0000 (18:03 +0100)
This reverts commit 5e2308b065427e15f96dbdcbfe65e6dfded9575e.

lib/db_ido/servicedbobject.cpp
lib/db_ido/servicedbobject.h

index dc838504237c7fc663157df7ebca0c261527fbe3..bb36b45e61fdbab6f97f530f0c80690cb1f2a92a 100644 (file)
@@ -31,7 +31,6 @@
 #include "icinga/externalcommandprocessor.h"
 #include "icinga/compatutility.h"
 #include "icinga/icingaapplication.h"
-#include "remote/endpoint.h"
 #include <boost/foreach.hpp>
 #include <boost/algorithm/string/join.hpp>
 
@@ -44,14 +43,14 @@ INITIALIZE_ONCE(&ServiceDbObject::StaticInitialize);
 void ServiceDbObject::StaticInitialize(void)
 {
        /* Status */
-       Service::OnCommentAdded.connect(boost::bind(&ServiceDbObject::AddComment, _1, _2, _3));
+       Service::OnCommentAdded.connect(boost::bind(&ServiceDbObject::AddComment, _1, _2));
        Service::OnCommentRemoved.connect(boost::bind(&ServiceDbObject::RemoveComment, _1, _2));
        Service::OnDowntimeAdded.connect(boost::bind(&ServiceDbObject::AddDowntime, _1, _2));
        Service::OnDowntimeRemoved.connect(boost::bind(&ServiceDbObject::RemoveDowntime, _1, _2));
        Service::OnDowntimeTriggered.connect(boost::bind(&ServiceDbObject::TriggerDowntime, _1, _2));
 
        /* History */
-       Service::OnCommentAdded.connect(boost::bind(&ServiceDbObject::AddCommentHistory, _1, _2, _3));
+       Service::OnCommentAdded.connect(boost::bind(&ServiceDbObject::AddCommentHistory, _1, _2));
        Service::OnDowntimeAdded.connect(boost::bind(&ServiceDbObject::AddDowntimeHistory, _1, _2));
        Service::OnAcknowledgementSet.connect(boost::bind(&ServiceDbObject::AddAcknowledgementHistory, _1, _2, _3, _4, _5));
 
@@ -332,21 +331,21 @@ void ServiceDbObject::AddComments(const Service::Ptr& service)
        ObjectLock olock(comments);
 
        BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
-               AddComment(service, kv.second, String());
+               AddComment(service, kv.second);
        }
 }
 
-void ServiceDbObject::AddComment(const Service::Ptr& service, const Comment::Ptr& comment, const String& authority)
+void ServiceDbObject::AddComment(const Service::Ptr& service, const Comment::Ptr& comment)
 {
-       AddCommentInternal(service, comment, false, authority);
+       AddCommentInternal(service, comment, false);
 }
 
-void ServiceDbObject::AddCommentHistory(const Service::Ptr& service, const Comment::Ptr& comment, const String& authority)
+void ServiceDbObject::AddCommentHistory(const Service::Ptr& service, const Comment::Ptr& comment)
 {
-       AddCommentInternal(service, comment, true, authority);
+       AddCommentInternal(service, comment, true);
 }
 
-void ServiceDbObject::AddCommentInternal(const Service::Ptr& service, const Comment::Ptr& comment, bool historical, const String& authority)
+void ServiceDbObject::AddCommentInternal(const Service::Ptr& service, const Comment::Ptr& comment, bool historical)
 {
        Host::Ptr host = service->GetHost();
 
@@ -358,16 +357,16 @@ void ServiceDbObject::AddCommentInternal(const Service::Ptr& service, const Comm
        Log(LogDebug, "db_ido", "adding service comment (id = " + Convert::ToString(comment->GetLegacyId()) + ") for '" + service->GetName() + "'");
 
        /* add the service comment */
-       AddCommentByType(service, comment, historical, authority);
+       AddCommentByType(service, comment, historical);
 
        /* add the hostcheck service comment to the host as well */
        if (host->GetCheckService() == service) {
                Log(LogDebug, "db_ido", "adding host comment (id = " + Convert::ToString(comment->GetLegacyId()) + ") for '" + host->GetName() + "'");
-               AddCommentByType(host, comment, historical, authority);
+               AddCommentByType(host, comment, historical);
        }
 }
 
-void ServiceDbObject::AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical, const String& authority)
+void ServiceDbObject::AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical)
 {
        unsigned long entry_time = static_cast<long>(comment->GetEntryTime());
        unsigned long entry_time_usec = (comment->GetEntryTime() - entry_time) * 1000 * 1000;
@@ -399,10 +398,6 @@ void ServiceDbObject::AddCommentByType(const DynamicObject::Ptr& object, const C
        fields1->Set("expiration_time", DbValue::FromTimestamp(comment->GetExpireTime()));
        fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */
 
-       Endpoint::Ptr endpoint = Endpoint::GetByName(authority);
-       if (endpoint)
-               fields1->Set("endpoint_object_id", endpoint);
-
        DbQuery query1;
        if (!historical) {
                query1.Table = "comments";
index 7f38e120316a856a72a69843af954224eb15062a..913bb2ad3c3146f4576646fff2e8593bafa59290 100644 (file)
@@ -75,8 +75,8 @@ protected:
        virtual void OnStatusUpdate(void);
 
 private:
-       static void AddCommentInternal(const Service::Ptr& service, const Comment::Ptr& comment, bool historical, const String& authority);
-       static void AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical, const String& authority);
+       static void AddCommentInternal(const Service::Ptr& service, const Comment::Ptr& comment, bool historical);
+       static void AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical);
         static void AddComments(const Service::Ptr& service);
         static void RemoveComments(const Service::Ptr& service);
 
@@ -88,7 +88,7 @@ private:
         static void AddLogHistory(const Service::Ptr& service, String buffer, LogEntryType type);
 
         /* Status */
-       static void AddComment(const Service::Ptr& service, const Comment::Ptr& comment, const String& authority);
+       static void AddComment(const Service::Ptr& service, const Comment::Ptr& comment);
        static void RemoveComment(const Service::Ptr& service, const Comment::Ptr& comment);
 
        static void AddDowntime(const Service::Ptr& service, const Downtime::Ptr& downtime);
@@ -96,7 +96,7 @@ private:
        static void TriggerDowntime(const Service::Ptr& service, const Downtime::Ptr& downtime);
 
         /* comment, downtime, acknowledgement history */
-        static void AddCommentHistory(const Service::Ptr& service, const Comment::Ptr& comment, const String& authority);
+        static void AddCommentHistory(const Service::Ptr& service, const Comment::Ptr& comment);
        static void AddDowntimeHistory(const Service::Ptr& service, const Downtime::Ptr& downtime);
         static void AddAcknowledgementHistory(const Service::Ptr& service, const String& author, const String& comment,
             AcknowledgementType type, double expiry);