From: Douglas Bagnall Date: Thu, 24 Mar 2022 05:39:55 +0000 (+1300) Subject: samba-tool gpo: clean up tmpdir after create X-Git-Tag: samba-4.17.0rc1~59 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0fdd7e16a1d2c68e3fa4262c8e7355b0889c5b66;p=thirdparty%2Fsamba.git samba-tool gpo: clean up tmpdir after create 'fetch' and 'backup' might also leave files in /tmp, but in those cases we want the files. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15006 Signed-off-by: Douglas Bagnall Reviewed-by: David Mulder Autobuild-User(master): Douglas Bagnall Autobuild-Date(master): Sat Aug 6 01:42:09 UTC 2022 on sn-devel-184 --- diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index 3b21dc6128c..fe8afa7d9a0 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -1296,6 +1296,10 @@ class cmd_create(GPOCommand): else: self.samdb.transaction_commit() + if tmpdir is None: + # Without --tmpdir, we created one in /tmp/. It must go. + shutil.rmtree(self.tmpdir) + self.outf.write("GPO '%s' created as %s\n" % (displayname, gpo))