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
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)
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()