From f110e266359deb0a98e359a3e24faef1f1d2ca5b Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Mon, 16 May 2022 12:54:26 +0200 Subject: [PATCH] IcingaDB: handle null (Empty) for value/set_if/separator in command arguments Icinga 2 treats null (Empty) as if the corresponding attribute is not specified. However, without this commit, it would serialize the value as "null" (i.e. type string), so that it ends up in the database as this string instead of NULL. This commit adds handling for ValueEmpty so that is serialized as JSON null value and ends up in the database as NULL. --- lib/icingadb/icingadb-objects.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index 85c1d567a..c95bfcedb 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -996,6 +996,7 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S // Stringify if set. if (values->Get(attr, &value)) { switch (value.GetType()) { + case ValueEmpty: case ValueString: break; case ValueObject: