mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-30 00:54:30 +02:00
Fixed remote replication of non-config attributes.
This commit is contained in:
parent
d4c6824056
commit
b9ee3b26eb
@ -468,16 +468,16 @@ void DynamicObject::RegisterClass(const String& type, DynamicObject::Factory fac
|
|||||||
GetClasses()[type] = factory;
|
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;
|
DynamicObject::ClassMap::iterator ct;
|
||||||
ct = GetClasses().find(type);
|
ct = GetClasses().find(type);
|
||||||
|
|
||||||
DynamicObject::Ptr obj;
|
DynamicObject::Ptr obj;
|
||||||
if (ct != GetClasses().end()) {
|
if (ct != GetClasses().end()) {
|
||||||
obj = ct->second(properties);
|
obj = ct->second(serializedUpdate);
|
||||||
} else {
|
} else {
|
||||||
obj = boost::make_shared<DynamicObject>(properties);
|
obj = boost::make_shared<DynamicObject>(serializedUpdate);
|
||||||
|
|
||||||
Logger::Write(LogCritical, "base", "Creating generic DynamicObject for type '" + type + "'");
|
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);
|
m_PersistentUpdates.erase(st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* apply the object's non-config attributes */
|
||||||
|
obj->ApplyUpdate(serializedUpdate, Attribute_All & ~Attribute_Config);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
static void RestoreObjects(const String& filename);
|
static void RestoreObjects(const String& filename);
|
||||||
|
|
||||||
static void RegisterClass(const String& type, Factory factory);
|
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 double GetCurrentTx(void);
|
||||||
static void BeginTx(void);
|
static void BeginTx(void);
|
||||||
|
@ -26,8 +26,6 @@ using namespace icinga;
|
|||||||
*/
|
*/
|
||||||
void CIBSyncComponent::Start(void)
|
void CIBSyncComponent::Start(void)
|
||||||
{
|
{
|
||||||
m_SyncingConfig = false;
|
|
||||||
|
|
||||||
m_Endpoint = boost::make_shared<VirtualEndpoint>();
|
m_Endpoint = boost::make_shared<VirtualEndpoint>();
|
||||||
|
|
||||||
/* config objects */
|
/* config objects */
|
||||||
@ -148,10 +146,6 @@ void CIBSyncComponent::FetchObjectsHandler(const Endpoint::Ptr& sender)
|
|||||||
|
|
||||||
void CIBSyncComponent::LocalObjectRegisteredHandler(const DynamicObject::Ptr& object)
|
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))
|
if (!ShouldReplicateObject(object))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -161,10 +155,6 @@ void CIBSyncComponent::LocalObjectRegisteredHandler(const DynamicObject::Ptr& ob
|
|||||||
|
|
||||||
void CIBSyncComponent::LocalObjectUnregisteredHandler(const DynamicObject::Ptr& object)
|
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))
|
if (!ShouldReplicateObject(object))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -259,14 +249,7 @@ void CIBSyncComponent::RemoteObjectRemovedHandler(const RequestMessage& request)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!object->IsLocal()) {
|
if (!object->IsLocal()) {
|
||||||
try {
|
object->Unregister();
|
||||||
m_SyncingConfig = true;
|
|
||||||
object->Unregister();
|
|
||||||
m_SyncingConfig = false;
|
|
||||||
} catch (...) {
|
|
||||||
m_SyncingConfig = false;
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
VirtualEndpoint::Ptr m_Endpoint;
|
VirtualEndpoint::Ptr m_Endpoint;
|
||||||
bool m_SyncingConfig;
|
|
||||||
|
|
||||||
static void ServiceStateChangeRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);
|
static void ServiceStateChangeRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ MBaAFNVJHVPJNwqEcG51lpqZJWVPaysFMA0GCSqGSIb3DQEBBQUAA4GBAIhhjKWw
|
|||||||
5JKirNidgG9PuD8x47VsRTkESLlq/pS7KjkE1nWCG9JpR5oVSzx2WXomiaAZ4q2C
|
5JKirNidgG9PuD8x47VsRTkESLlq/pS7KjkE1nWCG9JpR5oVSzx2WXomiaAZ4q2C
|
||||||
WS1z4HD9HF4NbhY+xVBi0Fj/kotuXCCweRo5EVp7Q4fabm1maJemFwMTHGhBLu7a
|
WS1z4HD9HF4NbhY+xVBi0Fj/kotuXCCweRo5EVp7Q4fabm1maJemFwMTHGhBLu7a
|
||||||
v4dquYyOk9Dhkwcjajyn+KWceCoUTdI3LB2t
|
v4dquYyOk9Dhkwcjajyn+KWceCoUTdI3LB2t
|
||||||
-----END CERTIFICATE----------BEGIN PRIVATE KEY-----
|
-----END CERTIFICATE-----
|
||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKznFbotQFqI2z7i
|
MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKznFbotQFqI2z7i
|
||||||
v+1nvbsCAS2ji3wcUESN/pOj8843bWl0+Io0/w0mr0OVOMBji2IdMrksqkvPEF/w
|
v+1nvbsCAS2ji3wcUESN/pOj8843bWl0+Io0/w0mr0OVOMBji2IdMrksqkvPEF/w
|
||||||
7Kgxi150lbPJk9+24qDDsNl4p6mjUOsSuL8otBWMUnsCOmDpGIu9d+TRGklIHfNo
|
7Kgxi150lbPJk9+24qDDsNl4p6mjUOsSuL8otBWMUnsCOmDpGIu9d+TRGklIHfNo
|
||||||
|
@ -1,25 +1,30 @@
|
|||||||
local object application "icinga" {
|
local object Application "icinga" {
|
||||||
ca = "ca.crt",
|
cert = "icinga-c2.pem",
|
||||||
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" {
|
local object Component "discovery" {
|
||||||
broker = 0
|
broker = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trusted upstream endpoint */
|
/* trusted upstream endpoint */
|
||||||
local object endpoint "icinga-c1" {
|
local object Endpoint "icinga-c1" {
|
||||||
node = "192.168.5.46",
|
node = "192.168.5.46",
|
||||||
service = 7777,
|
service = 7777,
|
||||||
|
|
||||||
roles = { "all" }
|
roles = { "all" }
|
||||||
}
|
}
|
||||||
|
|
||||||
local object role "all" {
|
local object Role "all" {
|
||||||
publications = { "*" },
|
publications = { "*" },
|
||||||
subscriptions = { "*" }
|
subscriptions = { "*" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user