Actions
Bug #18170
openLDAP search error with directive creation API when no id is provided
Pull Request:
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": { ....
Updated by François ARMAND over 4 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