[virt-tools-list] [virt-manager PATCH 04/12] installer: Cleanup process id & unattended cache dirs
Fabiano Fidêncio
fidencio at redhat.com
Thu Jun 6 14:11:35 UTC 2019
Any unattended installation creates a (or similar to)
~/.cache/virt-manager/$pid/unattended directory where the unattended
installations related files are stored.
Let's clean those dirs up during the clean up process.
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
virtinst/installer.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/virtinst/installer.py b/virtinst/installer.py
index e1f4e542..48436453 100644
--- a/virtinst/installer.py
+++ b/virtinst/installer.py
@@ -140,9 +140,19 @@ class Installer(object):
self._install_floppy_device.sync_path_props()
def _cleanup_unattended_files(self):
+ if not self._unattended_files:
+ return
+
for f in self._unattended_files:
os.unlink(f)
+ logging.debug("Removing %s", util.get_unattended_cache_dir())
+ os.rmdir(util.get_unattended_cache_dir())
+
+ pid_cache_dir = os.path.join(util.get_cache_dir(), str(os.getpid()))
+ logging.debug("Removing %s", pid_cache_dir)
+ os.rmdir(pid_cache_dir)
+
def _build_boot_order(self, guest, bootdev):
bootorder = [bootdev]
--
2.21.0
More information about the virt-tools-list
mailing list