[virt-manager PATCH 06/12] installertreemedia: 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/installertreemedia.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/virtinst/installertreemedia.py b/virtinst/installertreemedia.py
index ea522904..adfc0aca 100644
--- a/virtinst/installertreemedia.py
+++ b/virtinst/installertreemedia.py
@@ -211,6 +211,15 @@ class InstallerTreeMedia(object):
         for f in self._tmpfiles:
             logging.debug("Removing %s", str(f))
             os.unlink(f)
+        unattended_cache_dir = util.get_unattended_cache_dir()
+        if os.path.exists(unattended_cache_dir):
+            logging.debug("Removing %s", unattended_cache_dir)
+            os.rmdir(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)
 
         for vol in self._tmpvols:
             logging.debug("Removing volume '%s'", vol.name())
-- 
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