mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
parent
0449c66afc
commit
9413466cef
@ -126,7 +126,7 @@ void DynamicObject::InternalApplyUpdate(const Dictionary::Ptr& serializedUpdate,
|
|||||||
if (!HasAttribute(it->first))
|
if (!HasAttribute(it->first))
|
||||||
RegisterAttribute(it->first, static_cast<DynamicAttributeType>(type));
|
RegisterAttribute(it->first, static_cast<DynamicAttributeType>(type));
|
||||||
|
|
||||||
InternalSetAttribute(it->first, data, tx, suppressEvents);
|
InternalSetAttribute(it->first, data, tx, suppressEvents, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ Value DynamicObject::Get(const String& name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
|
void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
|
||||||
double tx, bool suppressEvent)
|
double tx, bool suppressEvent, bool allowEditConfig)
|
||||||
{
|
{
|
||||||
DynamicAttribute attr;
|
DynamicAttribute attr;
|
||||||
attr.Type = Attribute_Transient;
|
attr.Type = Attribute_Transient;
|
||||||
@ -172,6 +172,9 @@ void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
|
|||||||
|
|
||||||
Value oldValue;
|
Value oldValue;
|
||||||
|
|
||||||
|
if (!allowEditConfig && (tt.first->second.Type & Attribute_Config))
|
||||||
|
throw_exception(runtime_error("Config properties are immutable: '" + name + "'."));
|
||||||
|
|
||||||
if (!tt.second && tx >= tt.first->second.Tx) {
|
if (!tt.second && tx >= tt.first->second.Tx) {
|
||||||
oldValue = tt.first->second.Data;
|
oldValue = tt.first->second.Data;
|
||||||
tt.first->second.Data = data;
|
tt.first->second.Data = data;
|
||||||
|
@ -145,7 +145,7 @@ protected:
|
|||||||
virtual void OnAttributeChanged(const String& name, const Value& oldValue);
|
virtual void OnAttributeChanged(const String& name, const Value& oldValue);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InternalSetAttribute(const String& name, const Value& data, double tx, bool suppressEvent = false);
|
void InternalSetAttribute(const String& name, const Value& data, double tx, bool suppressEvent = false, bool allowEditConfig = false);
|
||||||
Value InternalGetAttribute(const String& name) const;
|
Value InternalGetAttribute(const String& name) const;
|
||||||
|
|
||||||
AttributeMap m_Attributes;
|
AttributeMap m_Attributes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user