Project

General

Profile

Bug #17774

Duplicate category name error when saving a new user technique

Added by François ARMAND 3 months ago. Updated 2 months ago.

Status:
Released
Priority:
N/A
Category:
Web - Config management
Target version:
Severity:
Major - prevents use of part of Rudder | no simple workaround
User visibility:
Infrequent - complex configurations | third party integrations
Effort required:
Very Small
Priority:
69

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

clipboard-202006172159-qldf5.png (20.4 KB) clipboard-202006172159-qldf5.png François ARMAND, 2020-06-17 21:59
clipboard-202006172200-j1fqr.png (4.65 KB) clipboard-202006172200-j1fqr.png François ARMAND, 2020-06-17 22:00

Related issues

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

Updated by François ARMAND 3 months ago

  • Subject changed from Duplicate category name erro when saving a new user technique to Duplicate category name error when saving a new user technique
#2

Updated by François ARMAND 3 months ago

  • Severity set to Major - prevents use of part of Rudder | no simple workaround
  • User visibility set to Infrequent - complex configurations | third party integrations
  • Effort required set to Very Small
  • Priority changed from 0 to 70

It should only happens for people whose active category id are not the default ones, so before very old rudder.

#3

Updated by François ARMAND 3 months ago

  • Status changed from New to In progress
#5

Updated by François ARMAND 3 months ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from François ARMAND to Vincent MEMBRÉ
  • Pull Request set to https://github.com/Normation/rudder/pull/3082
#6

Updated by François ARMAND 3 months ago

  • Status changed from Pending technical review to Pending release
#7

Updated by François ARMAND 3 months ago

  • Related to Bug #17862: error when importing techniques and running reload-techniques in 6.1 added
#8

Updated by Vincent MEMBRÉ 2 months ago

  • Related to Bug #18010: Users techniques are not created under any technique category when customed categories were used added
#9

Updated by Vincent MEMBRÉ 2 months ago

  • Status changed from Pending release to Released
  • Priority changed from 70 to 69

This bug has been fixed in Rudder 5.0.18 and 6.1.2 which were released today.

Also available in: Atom PDF