mirror of
https://github.com/samba-team/samba.git
synced 2025-08-09 17:49:29 +03:00
samba-tool: Fix for gpo restore not working without --tmpdir
cmd_restore depends on cmd_create but the later cleans up required temp files for cmd_restore to function. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15462 RN: Fix for gpo restore not working without --tmpdir Signed-off-by: Kacper Boström <kacper@kacper.se> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Sep 29 03:15:18 UTC 2023 on atb-devel-224
This commit is contained in:
@ -1664,6 +1664,11 @@ class cmd_restore(cmd_create):
|
||||
credopts, versionopts)
|
||||
|
||||
try:
|
||||
if tmpdir is None:
|
||||
# Create GPT
|
||||
self.tmpdir, gpodir = self.construct_tmpdir(tmpdir, self.gpo_name)
|
||||
self.gpodir = gpodir
|
||||
|
||||
# Iterate over backup files and restore with DTD
|
||||
self.restore_from_backup_to_local_dir(backup, self.gpodir,
|
||||
dtd_header)
|
||||
@ -1692,6 +1697,10 @@ class cmd_restore(cmd_create):
|
||||
|
||||
self.samdb.modify(m)
|
||||
|
||||
if tmpdir is None:
|
||||
# Without --tmpdir, we created one in /tmp/. It must go.
|
||||
shutil.rmtree(self.tmpdir)
|
||||
|
||||
except Exception as e:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
Reference in New Issue
Block a user