From 130fce032006f7e85bc1c379816124c425b56b3d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 15 Dec 2022 15:42:10 -0500 Subject: [PATCH] Prevent bulk renames from stomping on itself If multiple things try to renam to the same thing, block the action. --- confluent_server/confluent/config/configmanager.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index 30e37f18..166aaa2f 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -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(