From 8c38c7eddc41418578f3849b887ced0849f42d97 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 29 May 2018 12:54:44 +0200 Subject: [PATCH] Ensure that type names are lower cases for Redis lookups --- lib/redis/rediswriter-objects.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/redis/rediswriter-objects.cpp b/lib/redis/rediswriter-objects.cpp index fbbf86d5e..021691b86 100644 --- a/lib/redis/rediswriter-objects.cpp +++ b/lib/redis/rediswriter-objects.cpp @@ -120,7 +120,7 @@ void RedisWriter::UpdateAllConfigObjects(void) if (!ctype) continue; - String typeName = type->GetName(); + String typeName = type->GetName().ToLower(); /* replace into aka delete insert is faster than a full diff */ ExecuteQuery({ "DEL", "icinga:config:" + typeName, "icinga:config:" + typeName + ":checksum", "icinga:status:" + typeName }); @@ -157,6 +157,10 @@ void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool useTran UpdateObjectAttrs("icinga:config:", object, FAConfig); + Type::Ptr type = object->GetReflectionType(); + + String typeName = type->GetName().ToLower(); + // /* Serialize config object attributes */ // Dictionary::Ptr objectAttrs = SerializeObjectAttrs(object, FAConfig); // @@ -199,7 +203,6 @@ void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool useTran // ExecuteQuery({ "HSET", "icinga:config:" + typeName + ":checksum", objectName, checkSumBody }); if (runtimeUpdate) { - Type::Ptr type = object->GetReflectionType(); ExecuteQuery({ "PUBLISH", "icinga:config:update", type->GetName() + ":" + object->GetName() }); } @@ -215,7 +218,7 @@ void RedisWriter::SendConfigDelete(const ConfigObject::Ptr& object) if (!m_Context) return; - String typeName = object->GetReflectionType()->GetName(); + String typeName = object->GetReflectionType()->GetName().ToLower(); String objectName = object->GetName(); ExecuteQueries({