Actions
Bug #17774
closedDuplicate category name error when saving a new user technique
Status:
Released
Priority:
N/A
Assignee:
Category:
Web - Config management
Target version:
Pull Request:
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
User visibility:
Infrequent - complex configurations | third party integrations
Effort required:
Very Small
Priority:
69
Name check:
To do
Fix check:
To do
Regression:
Description
Coming from a very old rudder, in rudder 6.1 when we try to create a new user technique, we get an error:
[2020-06-17 14:29:26] ERROR com.normation.rudder.services.policies.TechniqueAcceptationUpdater - Error when trying to create to hierarchy of categories into which the new technique should be added: Consistancy: A category with that name already exists in that category: category names must be unique for a given level [2020-06-17 14:29:26] INFO com.normation.rudder.services.policies.TechniqueAcceptationUpdater - Automatically adding technique 'normation_com_wildcard_certificate' in category 'Root of active techniques's library (Active Techniques)' of active techniques library
This seems to be a consequence of #15575 (so from rudder 5.0.13).
The culprit looks like:
def findCategory(sourcesCatNames: List[CategoryInfo], existings: FullActiveTechniqueCategory): (ActiveTechniqueCategoryId, String) = { if(sourcesCatNames.isEmpty ) (existings.id, existings.name) else { val catId = sourcesCatNames.head.id.trim existings.subCategories.find { cat => cat.id.value == catId} match { case None => //create and go deeper createCategories(sourcesCatNames.map(x => CategoryInfo(x.id, x.name, x.description)), (existings.id, existings.name)) case Some(cat) => // continue ! findCategory(sourcesCatNames.tail, cat) } } }
==> we don't check for name existance before attempting to create the new category.
Files
Actions