Bug 12893 - tdb_copy bug in tdb_util.py
tdb_copy bug in tdb_util.py
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other
4.7.0rc1
All All
: P5 minor
: ---
Assigned To: Andrew Bartlett
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-10 20:28 UTC by Jeff Sadowski
Modified: 2017-07-11 20:32 UTC (History)
1 user (show)

See Also:


Attachments
fix missing tdbbackup error (566 bytes, patch)
2017-07-11 14:54 UTC, Jeff Sadowski
no flags Details
fix missing tdbbackup error take 2 (558 bytes, patch)
2017-07-11 15:01 UTC, Jeff Sadowski
no flags Details
fix missing tdbbackup error take 3 (561 bytes, patch)
2017-07-11 20:32 UTC, Jeff Sadowski
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Sadowski 2017-07-10 20:28:49 UTC
Overview:
The function "tdb_copy" assumes it will find tdbbackup and if not crashes with a hard to understand message about what is going on.

Steps to Reproduce:
Uninstall tdb-tools.
run "samba-tool domain provision --use-rfc2307 --interactive"
select BIND9_DLZ for DNS backend.

Actual Results:

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

Expected Results:
 Something meaningful that it couldn't find tdbbackup and that I should probably install tdb-tools.

Build Date & Hardware:
 fedora rawhide
 samba-dc.x86_64 2:4.7.0-0.4.rc1.fc27
 on a virtualbox x64 client machine.

Additional Information:
 I would add something like this:
 start=====>

    if not os.path.exists(toolpath):

       raise Exception("Error I could not find tdbbackup maybe you need to install tdb-tools?")

 <=====end

 after the search loop.
Comment 1 Jeff Sadowski 2017-07-11 14:54:27 UTC
Created attachment 13353 [details]
fix missing tdbbackup error
Comment 2 Jeff Sadowski 2017-07-11 15:01:43 UTC
Created attachment 13354 [details]
fix missing tdbbackup error take 2

Still learning git diff
Comment 3 Jeff Sadowski 2017-07-11 20:32:53 UTC
Created attachment 13358 [details]
fix missing tdbbackup error take 3

I think I did it correctly this time take two I tried to manually fix now I see how to do the git diff without adding two directories.