Project

General

Profile

Actions

Bug #17774

closed

Duplicate category name error when saving a new user technique

Added by François ARMAND over 4 years ago. Updated over 4 years ago.

Status:
Released
Priority:
N/A
Category:
Web - Config management
Target version:
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


Related issues 2 (0 open2 closed)

Related to Rudder - Bug #17862: error when importing techniques and running reload-techniques in 6.1RejectedActions
Related to Rudder - Bug #18010: Users techniques are not created under any technique category when customed categories were usedRejectedActions
Actions

Also available in: Atom PDF