Commit 18ffc0fe authored by Stephen Shirley's avatar Stephen Shirley Committed by René Nussbaumer
Browse files

Enforce that new node groups have unique names


Signed-off-by: default avatarStephen Shirley <diamond@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent e85d8982
......@@ -942,6 +942,16 @@ class ConfigWriter:
if check_uuid:
self._EnsureUUID(group, ec_id)
try:
existing_uuid = self._UnlockedLookupNodeGroup(group.name)
except errors.OpPrereqError:
pass
else:
raise errors.OpPrereqError("Desired group name '%s' already exists as a"
" node group (UUID: %s)" %
(group.name, existing_uuid),
errors.ECODE_EXISTS)
group.serial_no = 1
group.ctime = group.mtime = time.time()
group.UpgradeConfig()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment