]> granicus.if.org Git - icinga2/commitdiff
Fixed remote replication of non-config attributes.
authorGunnar Beutner <gunnar.beutner@netways.de>
Sat, 4 Aug 2012 08:23:18 +0000 (10:23 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Sat, 4 Aug 2012 08:23:18 +0000 (10:23 +0200)
base/dynamicobject.cpp
base/dynamicobject.h
components/cibsync/cibsynccomponent.cpp
components/cibsync/cibsynccomponent.h
icinga-app/icinga-c2.pem
icinga-app/icinga-checker1.conf

index da9ec8468fd7a22db9719f2c1080ace6f3f0d87d..78a4ea2adfbae1b1c22db3bc360088aca133d35f 100644 (file)
@@ -468,16 +468,16 @@ void DynamicObject::RegisterClass(const String& type, DynamicObject::Factory fac
        GetClasses()[type] = factory;
 }
 
-DynamicObject::Ptr DynamicObject::Create(const String& type, const Dictionary::Ptr& properties)
+DynamicObject::Ptr DynamicObject::Create(const String& type, const Dictionary::Ptr& serializedUpdate)
 {
        DynamicObject::ClassMap::iterator ct;
        ct = GetClasses().find(type);
 
        DynamicObject::Ptr obj;
        if (ct != GetClasses().end()) {
-               obj = ct->second(properties);
+               obj = ct->second(serializedUpdate);
        } else {
-               obj = boost::make_shared<DynamicObject>(properties);
+               obj = boost::make_shared<DynamicObject>(serializedUpdate);
 
                Logger::Write(LogCritical, "base", "Creating generic DynamicObject for type '" + type + "'");
        }
@@ -494,6 +494,9 @@ DynamicObject::Ptr DynamicObject::Create(const String& type, const Dictionary::P
                m_PersistentUpdates.erase(st);
        }
 
+       /* apply the object's non-config attributes */
+       obj->ApplyUpdate(serializedUpdate, Attribute_All & ~Attribute_Config);
+
        return obj;
 }
 
index ab3fb6f6afa82fd8b0c4abe873d46c957f47bb17..d44d8316c2872f2118d3ac09b4bdb72ee7d4574d 100644 (file)
@@ -118,7 +118,7 @@ public:
        static void RestoreObjects(const String& filename);
 
        static void RegisterClass(const String& type, Factory factory);
-       static DynamicObject::Ptr Create(const String& type, const Dictionary::Ptr& properties);
+       static DynamicObject::Ptr Create(const String& type, const Dictionary::Ptr& serializedUpdate);
 
        static double GetCurrentTx(void);
        static void BeginTx(void);
index 3093ae21212bccd23684d3fed3c30fc368f5a2b3..e1727f81994585397d902bd7cb5dbe4c21a6c933 100644 (file)
@@ -26,8 +26,6 @@ using namespace icinga;
  */
 void CIBSyncComponent::Start(void)
 {
-       m_SyncingConfig = false;
-
        m_Endpoint = boost::make_shared<VirtualEndpoint>();
 
        /* config objects */
@@ -148,10 +146,6 @@ void CIBSyncComponent::FetchObjectsHandler(const Endpoint::Ptr& sender)
 
 void CIBSyncComponent::LocalObjectRegisteredHandler(const DynamicObject::Ptr& object)
 {
-       /* don't send messages when we're currently processing a remote update */
-       if (m_SyncingConfig)
-               return;
-
        if (!ShouldReplicateObject(object))
                return;
 
@@ -161,10 +155,6 @@ void CIBSyncComponent::LocalObjectRegisteredHandler(const DynamicObject::Ptr& ob
 
 void CIBSyncComponent::LocalObjectUnregisteredHandler(const DynamicObject::Ptr& object)
 {
-       /* don't send messages when we're currently processing a remote update */
-       if (m_SyncingConfig)
-               return;
-
        if (!ShouldReplicateObject(object))
                return;
 
@@ -259,14 +249,7 @@ void CIBSyncComponent::RemoteObjectRemovedHandler(const RequestMessage& request)
                return;
 
        if (!object->IsLocal()) {
-               try {
-                       m_SyncingConfig = true;
-                       object->Unregister();
-                       m_SyncingConfig = false;
-               } catch (...) {
-                       m_SyncingConfig = false;
-                       throw;
-               }
+               object->Unregister();
        }
 }
 
index 7188fef12b59a84666f1606804c2ac825f6ed7b4..56456682fe7d273cfd6684ebce47ada4a0e48331 100644 (file)
@@ -34,7 +34,6 @@ public:
 
 private:
        VirtualEndpoint::Ptr m_Endpoint;
-       bool m_SyncingConfig;
 
        static void ServiceStateChangeRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);
 
index e1bc7de1332e8357a9b24c25c5ccdd30311407e0..420d800e80eef85ae59733ef52cc598c5f926d71 100644 (file)
@@ -14,7 +14,8 @@ MBaAFNVJHVPJNwqEcG51lpqZJWVPaysFMA0GCSqGSIb3DQEBBQUAA4GBAIhhjKWw
 5JKirNidgG9PuD8x47VsRTkESLlq/pS7KjkE1nWCG9JpR5oVSzx2WXomiaAZ4q2C
 WS1z4HD9HF4NbhY+xVBi0Fj/kotuXCCweRo5EVp7Q4fabm1maJemFwMTHGhBLu7a
 v4dquYyOk9Dhkwcjajyn+KWceCoUTdI3LB2t
------END CERTIFICATE----------BEGIN PRIVATE KEY-----
+-----END CERTIFICATE-----
+-----BEGIN PRIVATE KEY-----
 MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKznFbotQFqI2z7i
 v+1nvbsCAS2ji3wcUESN/pOj8843bWl0+Io0/w0mr0OVOMBji2IdMrksqkvPEF/w
 7Kgxi150lbPJk9+24qDDsNl4p6mjUOsSuL8otBWMUnsCOmDpGIu9d+TRGklIHfNo
index 15b09ff752a6ff7971905a121e96ab1eb5b319b1..b32ccb83a386cd13fff6e70445a9ec795ca207c3 100644 (file)
@@ -1,25 +1,30 @@
-local object application "icinga" {
-       ca = "ca.crt",
-       cert = "icinga-c2.pem"
+local object Application "icinga" {
+        cert = "icinga-c2.pem",
+        ca = "ca.crt",
+
+        pidpath = "icinga-checker1.pid",
+
+        macros = {
+                plugindir = "/usr/local/icinga/libexec"
+        }
 }
 
-local object component "checker" {
+local object Component "checker" {
 }
 
-local object component "discovery" {
-       broker = 0
+local object Component "discovery" {
+        broker = 0
 }
 
 /* trusted upstream endpoint */
-local object endpoint "icinga-c1" {
-       node = "192.168.5.46",
-       service = 7777,
+local object Endpoint "icinga-c1" {
+        node = "192.168.5.46",
+        service = 7777,
 
-       roles = { "all" }
+        roles = { "all" }
 }
 
-local object role "all" {
-       publications = { "*" },
-       subscriptions = { "*" }
+local object Role "all" {
+        publications = { "*" },
+        subscriptions = { "*" }
 }
-