[CentOS] Adding new root suffix to 389 server

Fri Aug 30 15:45:32 UTC 2013
Stephen Harris <lists at spuddy.org>

My apologies if this is off-topic...

On a centos6.4 system I installed 389 server from EPEL.  It seems to
work well enough.  However I'm trying to script things, rather than
do it via the GUI.  So, for example, I want to add a new suffix:

  #!/bin/ksh -p

  pswd=$(cat ~/passwd)

  add()
  {
  echo "dn: cn=example,cn=ldbm database,cn=plugins,cn=config
  changetype: add
  objectclass: extensibleObject
  objectclass: nsBackendInstance
  nsslapd-suffix: dc=example,dc=com

  dn: cn=dc=example\,dc=com,cn=mapping tree,cn=config
  changetype: add
  objectclass: top
  objectclass: extensibleObject
  objectclass: nsMappingTree
  nsslapd-state: backend
  nsslapd-backend: example
  cn: dc=example,dc=com
  " | ldapmodify -a -D "cn=directory manager" -w $pswd -h $1
  }

  add my_server

This appears to work.

  adding new entry "cn=example,cn=ldbm database,cn=plugins,cn=config"

  adding new entry "cn=dc=example\,dc=com,cn=mapping tree,cn=config"

However I then try and use this new root suffix:

  #!/bin/ksh -p

  pswd=$(cat ~/passwd)

  add()
  {
  echo "dn: dc=stephen_test,dc=example,dc=com
  objectClass: top
  objectClass: domain
  dc: stephen_test

  " | ldapmodify -a -D "cn=directory manager" -w $pswd -h $1
  }

  add my_server

And this fails
  adding new entry "dc=stephen_test,dc=example,dc=com"
  ldap_add: No such object (32)

Similarly:
  % ldapsearch -x -b 'dc=example,dc=com'       
  # extended LDIF
  #
  # LDAPv3
  # base <dc=example,dc=com> with scope subtree
  # filter: (objectclass=*)
  # requesting: ALL
  #

  # search result
  search: 2
  result: 32 No such object

  # numResponses: 1

Clearly I'm missing something obvious... but I can't see what!

-- 

rgds
Stephen