diff --git a/python/samba/netcmd/domain_backup.py b/python/samba/netcmd/domain_backup.py index 6cb0e512595..9c2c9e421f8 100644 --- a/python/samba/netcmd/domain_backup.py +++ b/python/samba/netcmd/domain_backup.py @@ -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) diff --git a/python/samba/tdb_util.py b/python/samba/tdb_util.py index badfbd66bba..99b6e02e03f 100644 --- a/python/samba/tdb_util.py +++ b/python/samba/tdb_util.py @@ -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: