mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 14:44:32 +02:00
Icinga DB: serialize icinga:config:checkcommand:argument#value and #set_if as expected
I.e. keep the serializations as simple as possible: null => null true => true 42.0 => 42 "foobar" => foobar {{42}} => Object of type 'Function' (["foobar"] and {"foo"="bar"} can't occur there.)
This commit is contained in:
parent
b08b30ee80
commit
f5abec20cf
@ -972,12 +972,20 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S
|
|||||||
values = new Dictionary({{"value", kv.second}});
|
values = new Dictionary({{"value", kv.second}});
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
for (const char *attr : {"value", "set_if"}) {
|
||||||
Value value;
|
Value value;
|
||||||
|
|
||||||
// JsonEncode() the value if it's set.
|
// Stringify if set.
|
||||||
if (values->Get("value", &value)) {
|
if (values->Get(attr, &value)) {
|
||||||
values->Set("value", JsonEncode(value));
|
switch (value.GetType()) {
|
||||||
|
case ValueString:
|
||||||
|
break;
|
||||||
|
case ValueObject:
|
||||||
|
values->Set(attr, value.Get<Object::Ptr>()->ToString());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
values->Set(attr, JsonEncode(value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user