mirror of https://github.com/Icinga/icinga2.git
Bugfixes.
This commit is contained in:
parent
a38379c56d
commit
99b153e482
|
@ -40,6 +40,9 @@ DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
|
|||
RegisterAttribute("__source", Attribute_Local);
|
||||
RegisterAttribute("methods", Attribute_Config);
|
||||
|
||||
if (!serializedObject->Contains("configTx"))
|
||||
throw invalid_argument("Serialized object must contain a config snapshot.");
|
||||
|
||||
/* apply state from the config item/remote update */
|
||||
ApplyUpdate(serializedObject, true);
|
||||
|
||||
|
@ -392,12 +395,8 @@ void DynamicObject::DumpObjects(const String& filename)
|
|||
|
||||
/* only persist properties for replicated objects or for objects
|
||||
* that are marked as persistent */
|
||||
if (!object->GetSource().IsEmpty() /*|| object->IsPersistent()*/) {
|
||||
if (!object->GetSource().IsEmpty() /*|| object->IsPersistent()*/)
|
||||
types |= Attribute_Config;
|
||||
persistentObject->Set("create", true);
|
||||
} else {
|
||||
persistentObject->Set("create", false);
|
||||
}
|
||||
|
||||
Dictionary::Ptr update = object->BuildUpdate(0, types);
|
||||
|
||||
|
@ -453,10 +452,10 @@ void DynamicObject::RestoreObjects(const String& filename)
|
|||
|
||||
String type = persistentObject->Get("type");
|
||||
String name = persistentObject->Get("name");
|
||||
int create = persistentObject->Get("create");
|
||||
bool hasConfig = persistentObject->Contains("configTx");
|
||||
Dictionary::Ptr update = persistentObject->Get("update");
|
||||
|
||||
if (create != 0) {
|
||||
if (hasConfig) {
|
||||
DynamicObject::Ptr object = Create(type, update);
|
||||
object->Register();
|
||||
} else {
|
||||
|
|
|
@ -131,7 +131,7 @@ bool CIBSyncComponent::ShouldReplicateObject(const DynamicObject::Ptr& object)
|
|||
|
||||
void CIBSyncComponent::FetchObjectsHandler(const Endpoint::Ptr& sender)
|
||||
{
|
||||
pair<DynamicObject::TypeMap::iterator, DynamicObject::TypeMap::iterator> trange;
|
||||
pair<DynamicObject::TypeMap::iterator, DynamicObject::TypeMap::iterator> trange = DynamicObject::GetTypes();
|
||||
DynamicObject::TypeMap::iterator tt;
|
||||
for (tt = trange.first; tt != trange.second; tt++) {
|
||||
DynamicObject::Ptr object;
|
||||
|
@ -156,7 +156,7 @@ void CIBSyncComponent::LocalObjectRegisteredHandler(const DynamicObject::Ptr& ob
|
|||
return;
|
||||
|
||||
EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint,
|
||||
MakeObjectMessage(object, "config::ObjectCommitted", 0, true));
|
||||
MakeObjectMessage(object, "config::ObjectUpdate", 0, true));
|
||||
}
|
||||
|
||||
void CIBSyncComponent::LocalObjectUnregisteredHandler(const DynamicObject::Ptr& object)
|
||||
|
|
|
@ -356,7 +356,7 @@ void DiscoveryComponent::ProcessDiscoveryMessage(const String& identity, const D
|
|||
if (message.GetService(&service) && !service.IsEmpty())
|
||||
info->Service = service;
|
||||
|
||||
DynamicObject::Ptr endpointConfig = DynamicObject::GetObject("endpoint", identity);
|
||||
DynamicObject::Ptr endpointConfig = DynamicObject::GetObject("Endpoint", identity);
|
||||
Dictionary::Ptr roles;
|
||||
if (endpointConfig)
|
||||
endpointConfig->GetAttribute("roles", &roles);
|
||||
|
|
Loading…
Reference in New Issue