error handling between ldb and python

tridge at tridge at
Fri Jun 12 03:00:22 GMT 2009

Hi Jelmer,

The samba4.local.torture.provision test is failing for me. I can
reproduce the error manually by running:

  bin/smbtorture ncalrpc: LOCAL-TORTURE

The backtrace is as follows:

 Traceback (most recent call last):                                                      
  File "bin/python/samba/", line 1163, in provision_become_dc               
    domain=domain, hostname=hostname, hostip="", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename)                                              
  File "bin/python/samba/", line 1028, in provision                                     
    credentials=credentials, lp=lp)
  File "bin/python/samba/", line 624, in setup_secretsdb
  File "bin/python/samba/", line 127, in erase

As far as I can tell, the problem seems to be with this code in

            except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
                # Ignore missing dn errors

the ldb_dlete call does set error code 32, which is
LDB_ERR_NO_SUCH_OBJECT, but the 'pass' above does not run. I showed
this by changing the code to:

            except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
                # Ignore missing dn errors
                print "got ERR_NO_SUCH_OBJECT"
                print "got another error"

and I do see "got another error" and the test then passwd. I haven't
been able to work out what the error code is at the python level

So a few questions:

 - how do I print what error the python binding thinks it got?

 - why is it LDB_ERR_NO_SUCH_OBJECT in the above, given this code:

	PyModule_AddObject(m, "ERR_NO_SUCH_OBJECT", PyInt_FromLong(LDB_ERR_NO_SUCH_OBJECT));

   from pyldb.c, wouldn't it be ERR_NO_SUCH_OBJECT, or
   ldb.ERR_NO_SUCH_OBJECT instead of LDB_ERR_NO_SUCH_OBJECT? How does
   the LDB_ prefix get added?

Andrew couldn't reproduce this bug on his system (fedora). It
happens on my Ubuntu Jaunty system, so it may be a matter of python

Any other clues on how to track this down?

Cheers, Tridge

More information about the samba-technical mailing list