Bug #18170
Updated by François ARMAND about 4 years ago
Trying to reproduce #14934, I got:
In curl:
<pre>
{"action":"createDirective","id":"","result":"error","errorDetails":"Could not create Directive <- Could not save Directive <- Can't execute LDAP request"}
</pre>
In webapp console:
<pre>
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)
</pre>
*WORKAROUND*: provide an uuid in JSNO:
<pre>
{
"displayName": "My Directive",
"enabled": true,
"id": "66b962cb-a039-4bf9-8e52-4ff10aeb6542",
"longDescription": "",
"parameters": {
....
</pre>