From 2a3bc61be30ed491872be27532b2b821d6e72613 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 29 Mar 2023 09:28:52 -0400 Subject: [PATCH] Avoid overwriting groups on a redefine When a node is being redefined, do not populate groups. That is only needed when truly defining for first time. --- confluent_server/confluent/config/configmanager.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index 4653ff92..a2d789c9 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -2201,9 +2201,6 @@ class ConfigManager(object): self._bg_sync_to_file() def add_node_attributes(self, attribmap): - for node in attribmap: - if 'groups' not in attribmap[node]: - attribmap[node]['groups'] = [] self.set_node_attributes(attribmap, autocreate=True) def rename_nodes(self, renamemap): @@ -2335,6 +2332,8 @@ class ConfigManager(object): '"{0}" is not a valid node name'.format(node)) if autocreate is False and node not in self._cfgstore['nodes']: raise ValueError("node {0} does not exist".format(node)) + if 'groups' not in attribmap[node] and node not in self._cfgstore['nodes']: + attribmap[node]['groups'] = [] for attrname in list(attribmap[node]): if attrname in _attraliases: truename = _attraliases[attrname]