From 30d0179db69ddc9087245ed384523e3fed1e7243 Mon Sep 17 00:00:00 2001 From: Justin Kulikauskas Date: Tue, 25 Apr 2023 17:18:40 -0400 Subject: [PATCH] Fix constantly updating objects with an empty list Similar to some other fixes we had for empty bools, strings, and ints. Refs: - https://issues.redhat.com/browse/ACM-5132 Signed-off-by: Justin Kulikauskas --- controllers/configurationpolicy_utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/configurationpolicy_utils.go b/controllers/configurationpolicy_utils.go index 04d0e04d..e9d42f90 100644 --- a/controllers/configurationpolicy_utils.go +++ b/controllers/configurationpolicy_utils.go @@ -115,6 +115,10 @@ func equalObjWithSort(mergedObj interface{}, oldObj interface{}) (areEqual bool) // this includes the case where oldObj is nil return false case []interface{}: + if len(mergedObj) == 0 && oldObj == nil { + return true + } + if oldObjList, ok := oldObj.([]interface{}); ok { return checkListsMatch(mergedObj, oldObjList) }