mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
parent
4fb5329e60
commit
6cc4f85c66
@ -130,6 +130,9 @@ void ConfigObject::ModifyAttribute(const String& attr, const Value& value, bool
|
||||
int fid = type->GetFieldId(fieldName);
|
||||
Field field = type->GetFieldInfo(fid);
|
||||
|
||||
if (field.Attributes & FAInternal || field.Attributes & FANoModify)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Attribute cannot be modified."));
|
||||
|
||||
if (field.Attributes & FAConfig) {
|
||||
if (!original_attributes) {
|
||||
original_attributes = new Dictionary();
|
||||
|
@ -68,8 +68,8 @@ private:
|
||||
|
||||
abstract class ConfigObject : ConfigObjectBase
|
||||
{
|
||||
[config, internal] String __name (Name);
|
||||
[config] String "name" (ShortName) {
|
||||
[config, internal, no_modify] String __name (Name);
|
||||
[config, no_modify] String "name" (ShortName) {
|
||||
get {{{
|
||||
if (m_ShortName.IsEmpty())
|
||||
return GetName();
|
||||
@ -77,22 +77,22 @@ abstract class ConfigObject : ConfigObjectBase
|
||||
return m_ShortName;
|
||||
}}}
|
||||
};
|
||||
[config, internal, get_protected] String type (TypeNameV);
|
||||
[config, internal, get_protected, no_modify] String type (TypeNameV);
|
||||
[config] name(Zone) zone (ZoneName);
|
||||
[config] String package;
|
||||
[config, internal, get_protected] Array::Ptr templates;
|
||||
[config, internal, get_protected, no_modify] Array::Ptr templates;
|
||||
[get_protected] bool active;
|
||||
[get_protected] bool paused {
|
||||
default {{{ return true; }}}
|
||||
};
|
||||
[get_protected, internal] bool start_called;
|
||||
[get_protected, internal] bool stop_called;
|
||||
[get_protected, internal] bool pause_called;
|
||||
[get_protected, internal] bool resume_called;
|
||||
[get_protected, internal, no_modify] bool start_called;
|
||||
[get_protected, internal, no_modify] bool stop_called;
|
||||
[get_protected, internal, no_modify] bool pause_called;
|
||||
[get_protected, internal, no_modify] bool resume_called;
|
||||
[enum] HAMode ha_mode (HAMode);
|
||||
[protected] Dictionary::Ptr extensions;
|
||||
[protected, no_modify] Dictionary::Ptr extensions;
|
||||
|
||||
[protected] bool state_loaded;
|
||||
[protected, no_modify] bool state_loaded;
|
||||
Dictionary::Ptr original_attributes;
|
||||
[state] double version {
|
||||
default {{{ return 0; }}}
|
||||
|
@ -38,7 +38,8 @@ enum FieldAttribute
|
||||
FAState = 4,
|
||||
FAInternal = 64,
|
||||
FARequired = 512,
|
||||
FANavigation = 1024
|
||||
FANavigation = 1024,
|
||||
FANoModify = 2048
|
||||
};
|
||||
|
||||
class Type;
|
||||
|
@ -27,7 +27,7 @@ namespace icinga
|
||||
|
||||
class Host : Checkable
|
||||
{
|
||||
[config] array(name(HostGroup)) groups {
|
||||
[config, no_modify] array(name(HostGroup)) groups {
|
||||
default {{{ return new Array(); }}}
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,7 @@ class Service : Checkable < ServiceNameComposer
|
||||
{
|
||||
load_after Host;
|
||||
|
||||
[config] array(name(ServiceGroup)) groups {
|
||||
[config, no_modify] array(name(ServiceGroup)) groups {
|
||||
default {{{ return new Array(); }}}
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ class User : CustomVarObject
|
||||
return m_DisplayName;
|
||||
}}}
|
||||
};
|
||||
[config] array(name(UserGroup)) groups {
|
||||
[config, no_modify] array(name(UserGroup)) groups {
|
||||
default {{{ return new Array(); }}}
|
||||
};
|
||||
[config, navigation] name(TimePeriod) period (PeriodRaw) {
|
||||
|
@ -146,6 +146,7 @@ protected { yylval->num = FAGetProtected | FASetProtected; return T_FIELD_ATTR
|
||||
internal { yylval->num = FAInternal; return T_FIELD_ATTRIBUTE; }
|
||||
no_storage { yylval->num = FANoStorage; return T_FIELD_ATTRIBUTE; }
|
||||
navigation { return T_NAVIGATION; }
|
||||
no_modify { yylval->num = FANoModify; return T_FIELD_ATTRIBUTE; }
|
||||
validator { return T_VALIDATOR; }
|
||||
required { return T_REQUIRED; }
|
||||
name { return T_NAME; }
|
||||
|
@ -71,7 +71,8 @@ enum FieldAttribute
|
||||
FANoStorage = 128,
|
||||
FALoadDependency = 256,
|
||||
FARequired = 512,
|
||||
FANavigation = 1024
|
||||
FANavigation = 1024,
|
||||
FANoModify = 2048
|
||||
};
|
||||
|
||||
struct FieldType
|
||||
|
Loading…
x
Reference in New Issue
Block a user