IcingaDB: don't always set icinga:config:*command:{argument,envvar}#value

This commit is contained in:
Alexander A. Klimov 2019-11-26 13:21:50 +01:00
parent 287e4c3a8d
commit c01c22ae76
1 changed files with 18 additions and 2 deletions

View File

@ -698,7 +698,15 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S
values = new Dictionary({{"value", kv.second}}); values = new Dictionary({{"value", kv.second}});
} }
values->Set("value", JsonEncode(values->Get("value"))); {
Value value;
// JsonEncode() the value if it's set.
if (values->Get("value", &value)) {
values->Set("value", JsonEncode(value));
}
}
values->Set("command_id", objectKey); values->Set("command_id", objectKey);
values->Set("argument_key", kv.first); values->Set("argument_key", kv.first);
values->Set("environment_id", envId); values->Set("environment_id", envId);
@ -737,7 +745,15 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S
values = new Dictionary({{"value", kv.second}}); values = new Dictionary({{"value", kv.second}});
} }
values->Set("value", JsonEncode(values->Get("value"))); {
Value value;
// JsonEncode() the value if it's set.
if (values->Get("value", &value)) {
values->Set("value", JsonEncode(value));
}
}
values->Set("command_id", objectKey); values->Set("command_id", objectKey);
values->Set("envvar_key", kv.first); values->Set("envvar_key", kv.first);
values->Set("environment_id", envId); values->Set("environment_id", envId);