2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 11:30:23 +00:00

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.
This commit is contained in:
Jarrod Johnson 2023-03-29 09:28:52 -04:00
parent 73fb54ccbc
commit 2a3bc61be3

View File

@ -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]