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 <fiden...@redhat.com>
---
 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@redhat.com
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to