extended provision-backend

Andrew Bartlett abartlet at samba.org
Fri Aug 7 03:41:47 MDT 2009


On Fri, 2009-08-07 at 11:14 +0200, Oliver Liebel wrote:
> >> thank you very much!
> >> i call on you if i got some more questions.
> >>     
> >
> > No worries.  Thanks!
> >   
> nearly done with ldb -ldapsearch.
> one more question:
> how can i handle the exception (when no rootdse is found,
> means, no slapds running). i tried this:
> 
>  try:
>         ldapi_uri = "ldapi://" +
> urllib.quote(os.path.join(paths.private_dir, "ldap", "ldapi"), safe="")
>         ldapi_db = Ldb(ldapi_uri)
>         search_ol_rootdse = ldapi_db.search(base="", scope=SCOPE_BASE,
>                           expression="(objectClass=OpenLDAProotDSE)");
>         message(search_ol_rootdse)
> 
>     except ldb.LdbError, e:
>         message("ldap-search Output:")
>    
> but i got this error, when slapd is not up:
> 
> " except ldb.LdbError, e:
> NameError: global name 'ldb' is not defined"
> 
> 
> when i try:
> except ldapi_db.LdbError, e:
>  
> instead, i got the following error:
> "AttributeError: 'Ldb' object has no attribute 'LdbError'"

what about:
except Ldb.LdbError.

But I think treating any error there as a good indication that there
isn't a slapd running should be fine.  

Also see the other examples in provision.py, which do:
except LdbError


Andrew Bartlett

-- 
Andrew Bartlett
http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090807/235a5875/attachment.pgp>


More information about the samba-technical mailing list