Merge pull request #7656 from Icinga/bugfix/icingadb-command-arg-value-null

IcingaDB: don't always set icinga:config:*command:{argument,envvar}#value
This commit is contained in:
Noah Hilverling 2019-12-03 12:53:03 +01:00 committed by GitHub
commit 355973d600
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 2 deletions

View File

@ -643,7 +643,15 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S
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("argument_key", kv.first);
values->Set("environment_id", envId);
@ -682,7 +690,15 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S
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("envvar_key", kv.first);
values->Set("environment_id", envId);