]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool domain provision: better message if tdbbackup missing
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Sun, 21 Aug 2022 23:48:53 +0000 (11:48 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 6 Sep 2022 21:12:36 +0000 (21:12 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12893

Reported-by: Jeff Sadowski <jeff.sadowski@gmail.com>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/domain_backup.py
python/samba/tdb_util.py

index 6cb0e51259513f8b8241d134b84daf8b8f2717ad..9c2c9e421f89ecb65c27ea9a856b9c571fb26168 100644 (file)
@@ -983,10 +983,16 @@ class cmd_domain_backup_offline(samba.netcmd.Command):
                     return
                 raise e
             raise copy_err
+
+        except FileNotFoundError as e:
+            # tdbbackup tool was not found.
+            raise CommandError(e.strerror, e)
+
         if not os.path.exists(backup_path):
             s = "tdbbackup said backup succeeded but {0} not found"
             raise CommandError(s.format(backup_path))
 
+
     def offline_mdb_copy(self, path):
         mdb_copy(path, path + self.backup_ext)
 
index badfbd66bba429f478d9fde9a88b02b26cb23cd5..99b6e02e03f5e6659e1f0b148a10503e419e1712 100644 (file)
@@ -32,6 +32,10 @@ def tdb_copy(file1, file2, readonly=False):
         toolpath = os.path.join(d, "tdbbackup")
         if os.path.exists(toolpath):
             break
+    else:
+        # we did not find a path to tdbbackup
+        raise FileNotFoundError(2, "could not find tdbbackup tool: "
+                                "is tdb-tools installed?")
 
     tdbbackup_cmd = [toolpath, "-s", ".copy.tdb", file1]
     if readonly: