From 8e7763aa258fbdc69315e64ee232a6fea7cca125 Mon Sep 17 00:00:00 2001 From: Damien Claisse Date: Mon, 3 Oct 2022 14:52:34 +0000 Subject: [PATCH] connect: fix shouldPersistNewRootAndConfig logic https://github.com/hashicorp/consul/pull/12298 introduced an improvement to prevent raft commit for no-op operations, but while moving conditions into a function, author inversed the logic while keep same boolean operations. As a consequence, this prevents one to update provider config of a secondary CA. Correct code was suggested in a review comment anyway, so apply it: https://github.com/hashicorp/consul/pull/12298#pullrequestreview-877823650 --- agent/consul/leader_connect_ca.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/consul/leader_connect_ca.go b/agent/consul/leader_connect_ca.go index ec0c77bbd178..ad7e70bbe33e 100644 --- a/agent/consul/leader_connect_ca.go +++ b/agent/consul/leader_connect_ca.go @@ -754,7 +754,7 @@ func shouldPersistNewRootAndConfig(newActiveRoot *structs.CARoot, oldConfig, new if newConfig == nil { return false } - return newConfig.Provider == oldConfig.Provider && reflect.DeepEqual(newConfig.Config, oldConfig.Config) + return newConfig.Provider != oldConfig.Provider || !reflect.DeepEqual(newConfig.Config, oldConfig.Config) } func (c *CAManager) UpdateConfiguration(args *structs.CARequest) (reterr error) {