uncaught exception while provisioning.

Jeff Sadowski jeff.sadowski at gmail.com
Wed Jul 12 14:55:33 UTC 2017


I was trying to be helpful but looks like I kicked up a bunch of worms.
So the other day I was trying to provision samba and it spat out a bunch of
python errors

ERROR(<type 'exceptions.OSError'>): uncaught exception - [Errno 2] No such
file or directory
  File "/usr/lib64/python2.7/site-packages/samba/netcmd/__init__.py", line
176, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/samba/netcmd/domain.py", line
474, in run
    nosync=ldap_backend_nosync, ldap_dryrun_mode=ldap_dryrun_mode)
  File "/usr/lib64/python2.7/site-packages/samba/provision/__init__.py",
line 2175, in provision
    skip_sysvolacl=skip_sysvolacl)
  File "/usr/lib64/python2.7/site-packages/samba/provision/__init__.py",
line 1836, in provision_fill
    targetdir=targetdir, fill_level=samdb_fill)
  File "/usr/lib64/python2.7/site-packages/samba/provision/sambadns.py",
line 1162, in setup_ad_dns
    hostip6=hostip6, targetdir=targetdir)
  File "/usr/lib64/python2.7/site-packages/samba/provision/sambadns.py",
line 1222, in setup_bind9_dns
    create_samdb_copy(samdb, logger, paths, names, names.domainsid,
domainguid)
  File "/usr/lib64/python2.7/site-packages/samba/provision/sambadns.py",
line 851, in create_samdb_copy
    os.path.join(dns_dir, "sam.ldb"))
  File "/usr/lib64/python2.7/site-packages/samba/tdb_util.py", line 36, in
tdb_copy
    status = subprocess.call(tdbbackup_cmd, close_fds=True, shell=False)
  File "/usr/lib64/python2.7/subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib64/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception

I traced it down to tdb_util.py looking for tdbbackup (which I did not have
because of not installing tdb-tools)
I was able to install then but wanted to fix the provisioning tool to
report better.

I created a bug report that tdb_util.py didn't check to see if it really
found tdbbackup it just assumed it had and tried using it.
producing the issue above.

I thought it would be nice to check if it had found it and throw a more
meaningful error

So I created the attached patch

With my patch I get the following

ERROR(exception): uncaught exception - Error I could not find tdbbackup
maybe you need to install tdb-tools
  File "/usr/lib64/python2.7/site-packages/samba/netcmd/__init__.py", line
176, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/samba/netcmd/domain.py", line
474, in run
    nosync=ldap_backend_nosync, ldap_dryrun_mode=ldap_dryrun_mode)
  File "/usr/lib64/python2.7/site-packages/samba/provision/__init__.py",
line 2175, in provision
    skip_sysvolacl=skip_sysvolacl)
  File "/usr/lib64/python2.7/site-packages/samba/provision/__init__.py",
line 1836, in provision_fill
    targetdir=targetdir, fill_level=samdb_fill)
  File "/usr/lib64/python2.7/site-packages/samba/provision/sambadns.py",
line 1162, in setup_ad_dns
    hostip6=hostip6, targetdir=targetdir)
  File "/usr/lib64/python2.7/site-packages/samba/provision/sambadns.py",
line 1222, in setup_bind9_dns
    create_samdb_copy(samdb, logger, paths, names, names.domainsid,
domainguid)
  File "/usr/lib64/python2.7/site-packages/samba/provision/sambadns.py",
line 851, in create_samdb_copy
    os.path.join(dns_dir, "sam.ldb"))
  File "/usr/lib64/python2.7/site-packages/samba/tdb_util.py", line 36, in
tdb_copy
    raise Exception("Error I could not find tdbbackup maybe you need to"

which does provide a bit more useful error but doesn't solve the "uncaught
exception" error and throw up of python

seems each level of function calls just does nothing with the exceptions
provided by the lower level function calls and lets
the exceptions percolate all the way to the top level being python that
spits out the message it does.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-missing-tdbbackup-error.patch
Type: text/x-patch
Size: 561 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170712/3c989de8/fix-missing-tdbbackup-error.bin>


More information about the samba-technical mailing list