Project

General

Profile

Actions

Bug #18170

open

LDAP search error with directive creation API when no id is provided

Added by François ARMAND over 3 years ago. Updated 3 days ago.

Status:
New
Priority:
N/A
Category:
API
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:

Description

Trying to reproduce #14934, I got:

In curl:

{"action":"createDirective","id":"","result":"error","errorDetails":"Could not create Directive <- Could not save Directive  <- Can't execute LDAP request"}

In webapp console:

com.unboundid.ldap.sdk.LDAPSearchException: invalid DN
        at com.unboundid.ldap.sdk.LDAPConnection.search(LDAPConnection.java:3772)
        at com.unboundid.ldap.sdk.LDAPConnection.getEntry(LDAPConnection.java:1803)
        at com.unboundid.ldap.sdk.LDAPConnection.getEntry(LDAPConnection.java:1770)
        at com.normation.ldap.sdk.RoLDAPConnection.get(LDAPConnection.scala:312)
        at com.normation.ldap.sdk.RwLDAPConnection.save(LDAPConnection.scala:580)
        at com.normation.rudder.repository.ldap.WoLDAPDirectiveRepository.$anonfun$internalSaveDirective$10(LDAPDirectiveRepository.scala:595)
        at com.normation.rudder.repository.ldap.ScalaLock.$anonfun$apply$1(Lock.scala:46)
        at com.normation.rudder.repository.ldap.ScalaLock.map(Lock.scala:36)
        at com.normation.rudder.repository.ldap.ScalaLock.map$(Lock.scala:33)
        at com.normation.rudder.repository.ldap.ScalaLock$$anon$1.map(Lock.scala:60)
        at com.normation.rudder.repository.ldap.ScalaLock.apply(Lock.scala:46)
        at com.normation.rudder.repository.ldap.ScalaLock.apply$(Lock.scala:46)
        at com.normation.rudder.repository.ldap.ScalaLock$$anon$1.apply(Lock.scala:60)
        at com.normation.rudder.repository.ldap.WoLDAPDirectiveRepository.$anonfun$internalSaveDirective$9(LDAPDirectiveRepository.scala:595)
        at net.liftweb.common.Full.flatMap(Box.scala:856)
        at com.normation.rudder.repository.ldap.WoLDAPDirectiveRepository.$anonfun$internalSaveDirective$7(LDAPDirectiveRepository.scala:590)
        at net.liftweb.common.Full.flatMap(Box.scala:856)
        at com.normation.rudder.repository.ldap.WoLDAPDirectiveRepository.$anonfun$internalSaveDirective$3(LDAPDirectiveRepository.scala:560)
        at net.liftweb.common.Full.flatMap(Box.scala:856)
        at com.normation.rudder.repository.ldap.WoLDAPDirectiveRepository.$anonfun$internalSaveDirective$1(LDAPDirectiveRepository.scala:559)
        at com.normation.ldap.sdk.LDAPConnectionProvider.$anonfun$flatMap$1(LDAPConnectionProvider.scala:117)
        at com.normation.ldap.sdk.LDAPConnectionProvider.withCon(LDAPConnectionProvider.scala:154)
        at com.normation.ldap.sdk.LDAPConnectionProvider.withCon$(LDAPConnectionProvider.scala:143)
        at com.normation.ldap.sdk.RWPooledSimpleAuthConnectionProvider.withCon(LDAPConnectionProvider.scala:395)
        at com.normation.ldap.sdk.LDAPConnectionProvider.flatMap(LDAPConnectionProvider.scala:116)
        at com.normation.ldap.sdk.LDAPConnectionProvider.flatMap$(LDAPConnectionProvider.scala:115)
        at com.normation.ldap.sdk.RWPooledSimpleAuthConnectionProvider.flatMap(LDAPConnectionProvider.scala:395)
        at com.normation.rudder.repository.ldap.WoLDAPDirectiveRepository.internalSaveDirective(LDAPDirectiveRepository.scala:558)
        at com.normation.rudder.repository.ldap.WoLDAPDirectiveRepository.saveDirective(LDAPDirectiveRepository.scala:639)
        at com.normation.rudder.rest.lift.DirectiveAPIService2.$anonfun$actualDirectiveCreation$6(DirectiveApi.scala:283)
        at net.liftweb.common.Full.flatMap(Box.scala:856)
        at com.normation.rudder.rest.lift.DirectiveAPIService2.$anonfun$actualDirectiveCreation$1(DirectiveApi.scala:276)
        at net.liftweb.common.Full.flatMap(Box.scala:856)
        at com.normation.rudder.rest.lift.DirectiveAPIService2.actualDirectiveCreation(DirectiveApi.scala:270)
        at com.normation.rudder.rest.lift.DirectiveAPIService2.$anonfun$createDirective$8(DirectiveApi.scala:312)
        at com.normation.rudder.rest.RestUtils$.$anonfun$actionResponse2$3(RestUtils.scala:170)
        at net.liftweb.common.Full.flatMap(Box.scala:856)
        at com.normation.rudder.rest.RestUtils$.$anonfun$actionResponse2$2(RestUtils.scala:170)
        at net.liftweb.common.Full.flatMap(Box.scala:856)
        at com.normation.rudder.rest.RestUtils$.actionResponse2(RestUtils.scala:168)
        at com.normation.rudder.rest.lift.DirectiveApi.actionResponse(DirectiveApi.scala:96)

WORKAROUND: provide an uuid in JSNO:

{
  "displayName": "My Directive",
    "enabled": true,
    "id": "66b962cb-a039-4bf9-8e52-4ff10aeb6542",
    "longDescription": "",
    "parameters": {
....


Related issues 1 (0 open1 closed)

Related to Rudder - Bug #14934: Rudder directive API seem to take key-value order into account in json POST request ReleasedFrançois ARMANDActions
Actions #1

Updated by François ARMAND over 3 years ago

  • Related to Bug #14934: Rudder directive API seem to take key-value order into account in json POST request added
Actions #2

Updated by François ARMAND over 3 years ago

  • Subject changed from LDAP search error with directive creation API to LDAP search error with directive creation API when no id is provided

The problem is that in the example JSON, no id is defined. And we don't generate one, so we try to save directive:

directiveId=,activeTechniqueId=1734858c-dd66-4fe4-8c29-266f4bc79622,techniqueCategoryId=userManagement,techniqueCategoryId=systemSettings,techniqueCategoryId=Active Techniques,ou=Rudder,cn=rudder-configuration

If we add a generated ID in the corresponding JSON field, save is OK.

Actions #3

Updated by François ARMAND over 3 years ago

  • Description updated (diff)
Actions #4

Updated by Vincent MEMBRÉ over 3 years ago

  • Target version changed from 5.0.20 to 797
Actions #5

Updated by Benoît PECCATTE over 2 years ago

  • Target version changed from 797 to 6.1.14
Actions #6

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 6.1.14 to 6.1.15
Actions #7

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 6.1.15 to 6.1.16
Actions #8

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 6.1.16 to 6.1.17
Actions #9

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 6.1.17 to 6.1.18
Actions #10

Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 6.1.18 to 6.1.19
Actions #11

Updated by Vincent MEMBRÉ almost 2 years ago

  • Target version changed from 6.1.19 to 6.1.20
Actions #12

Updated by Vincent MEMBRÉ almost 2 years ago

  • Target version changed from 6.1.20 to 6.1.21
Actions #13

Updated by Vincent MEMBRÉ over 1 year ago

  • Target version changed from 6.1.21 to old 6.1 issues to relocate
Actions #14

Updated by Alexis Mousset about 1 year ago

  • Target version changed from old 6.1 issues to relocate to old 6.2 issues to relocate
Actions #15

Updated by Alexis Mousset 7 months ago

  • Target version changed from old 6.2 issues to relocate to 7.2.11
Actions #16

Updated by Vincent MEMBRÉ 6 months ago

  • Target version changed from 7.2.11 to 1046
Actions #17

Updated by Alexis Mousset 5 months ago

  • Target version changed from 1046 to 7.3.8
Actions #18

Updated by Vincent MEMBRÉ 4 months ago

  • Target version changed from 7.3.8 to 7.3.9
Actions #19

Updated by Vincent MEMBRÉ 4 months ago

  • Target version changed from 7.3.9 to 7.3.10
Actions #20

Updated by Vincent MEMBRÉ 3 months ago

  • Target version changed from 7.3.10 to 7.3.11
Actions #21

Updated by Vincent MEMBRÉ about 1 month ago

  • Target version changed from 7.3.11 to 7.3.12
Actions #22

Updated by Vincent MEMBRÉ 3 days ago

  • Target version changed from 7.3.12 to 7.3.13
Actions

Also available in: Atom PDF