2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Prevent bulk renames from stomping on itself

If multiple things try to renam to the same thing, block the action.
This commit is contained in:
Jarrod Johnson 2022-12-15 15:42:10 -05:00
parent 367854128a
commit 130fce0320

View File

@ -2186,6 +2186,8 @@ class ConfigManager(object):
','.join(missingnodes)))
newnames = set([])
for name in renamemap:
if renamemap[name] in newnames:
raise ValueError('Requested to rename multiple nodes to the same name: {0}'.format(renamemap[name]))
newnames.add(renamemap[name])
if newnames & currnodes:
raise ValueError(
@ -2230,6 +2232,8 @@ class ConfigManager(object):
','.join(missinggroups)))
newnames = set([])
for name in renamemap:
if renamemap[name] in newnames:
raise ValueError('Requested to rename multiple groups to the same name: {0}'.format(name))
newnames.add(renamemap[name])
if newnames & currgroups:
raise ValueError(