|

Wednesday July 27, 2005
Working Around idsconfig "Can not determine the top of tree" errors
Currently we doing a bit of work that requires native ldap, and as part of your setup you use idsconfig(1M) to do some configuration work on your directory server, and unfortunately in some scenarios on Solaris 9 it can throw the following rather cryptic error message
ERROR: Can not determine the top of tree
which is not very usefull.
I hadn't seen this issue recently as it was fixed as bugid 4510686 in Solaris 10 which I had been using for my initial exploration, and I had also hand installed my directory server without allowing it to put in sample data. But as I moved to a box reinstalled with Solaris 9 earlier today to replicate a known customer environment and after being jumpstarted it ran through a base install of the Sun Java System Directory Server using a silent install file that I had for a different rig, and just tried to use a previously generated server config file from idsconfig (sometimes trying to be too smart with automation can bite :( ).
Now the silent install file I had used to install the directory server also created some sample data, leading to multiple namingContexts in the ldap server with was the cause of my problem. In our case we are using a DN of dc=jestest,dc=sun,dc=com, which is what I expected idsconfig to pick up, but if you do an ldapsearch against this you get the following
# /usr/bin/ldapsearch -h ds -p 389 -D "cn=Directory Manager" -w "daPasswd" \
-b "" -s base objectclass=* | grep namingContext
namingContexts=dc=example, dc=com
namingContexts=dc=jestest,dc=sun,dc=com
namingContexts=o=NetscapeRoot
Within idsconfig there is a function discover_serv_info(), with the following code
discover_serv_info()
{
[ $DEBUG -eq 1 ] && ${ECHO} "In discover_serv_info()"
# Search the server for the TOP of the TREE.
${LDAPSEARCH} ${SERVER_ARGS} -b "" -s base "objectclass=*" > ${TMPDIR}/checkTOP 2>&1
${GREP} -i namingcontexts ${TMPDIR}/checkTOP | \
${GREP} -i -v NetscapeRoot > ${TMPDIR}/treeTOP
NUM_TOP=`wc -l ${TMPDIR}/treeTOP | awk '{print $1}'`
if [ $NUM_TOP -ne 1 ]; then
${ECHO} "ERROR: Can not determine the top of tree"
exit 1
fi
LDAP_TREETOP=`cat ${TMPDIR}/treeTOP | cut -f2- -d='`
[ $DEBUG -eq 1 ] && ${ECHO} " LDAP_TREETOP = $LDAP_TREETOP"
}
As we can see our extra "dc=example,dc=com" line is going to cause a few problems. So the quick hack (and completely unsupported) work around is do and in an extra grep -i <our naming context> in our namingcontexts section, giving us the following line
${GREP} -i namingcontexts ${TMPDIR}/checkTOP | \
${GREP} -i -v NetscapeRoot | ${GREP} -i jestest > ${TMPDIR}/treeTOP
And of course the correct work around is to upgrade to Solaris 10 ;).
(2005-07-27 13:03:33.0)
Permalink
|