[virt-manager PATCH 04/12] installer: Cleanup process id & unattended cache dirs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux