diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index acbf207fe..307cba399 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -320,7 +320,12 @@ void Downtime::TriggerDowntime(void) { ObjectLock olock(triggers); BOOST_FOREACH(const String& triggerName, triggers) { - Downtime::GetByName(triggerName)->TriggerDowntime(); + Downtime::Ptr downtime = Downtime::GetByName(triggerName); + + if (!downtime) + continue; + + downtime->TriggerDowntime(); } } diff --git a/lib/icinga/downtime.ti b/lib/icinga/downtime.ti index e6be9d443..cc4702707 100644 --- a/lib/icinga/downtime.ti +++ b/lib/icinga/downtime.ti @@ -76,9 +76,9 @@ class Downtime : ConfigObject < DowntimeNameComposer [state] double trigger_time; [config] bool fixed; [config] double duration; - [state] name(Downtime) triggered_by; + [config] name(Downtime) triggered_by; [config] String scheduled_by; - [config] Array::Ptr triggers { + [state] Array::Ptr triggers { default {{{ return new Array(); }}} }; int legacy_id; diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp index 1747fe71f..442c5c80a 100644 --- a/lib/remote/configobjectutility.cpp +++ b/lib/remote/configobjectutility.cpp @@ -71,14 +71,14 @@ String ConfigObjectUtility::CreateObjectConfig(const Type::Ptr& type, const Stri ObjectLock olock(attrs); BOOST_FOREACH(const Dictionary::Pair& kv, attrs) { - int fid = type->GetFieldId(kv.first); + int fid = type->GetFieldId(kv.first.SubStr(0, kv.first.FindFirstOf("."))); if (fid < 0) BOOST_THROW_EXCEPTION(ScriptError("Invalid attribute specified: " + kv.first)); Field field = type->GetFieldInfo(fid); - if (field.Attributes & FANoUserModify) + if (!(field.Attributes & FAConfig) || kv.first == "name") BOOST_THROW_EXCEPTION(ScriptError("Attribute is marked for internal use only and may not be set: " + kv.first)); } }