[et-mgmt-tools] [PATCH] Remove temporary treeinfo files from /var/tmp

Mark McLoughlin markmc at redhat.com
Wed Apr 23 15:11:43 UTC 2008


# HG changeset patch
# User Mark McLoughlin <markmc at redhat.com>
# Date 1208962770 -3600
# Node ID c7e565fa0b688738b9c077c4349e427501c31811
# Parent  c54605ffcd7b4356b2c02c85bb2c4413eae6fa53
Remove temporary treeinfo files from /var/tmp

Signed-off-by: Mark McLoughlin <markmc at redhat.com>

diff -r c54605ffcd7b -r c7e565fa0b68 virtinst/OSDistro.py
--- a/virtinst/OSDistro.py	Mon Apr 21 18:07:25 2008 -0400
+++ b/virtinst/OSDistro.py	Wed Apr 23 15:59:30 2008 +0100
@@ -56,17 +56,22 @@ class RedHatDistro(Distro):
 
     def hasTreeinfo(self, fetcher, progresscb):
         # all Red Hat based distros should have .treeinfo / execute only once
-        if (self.treeinfo is None):
-            if fetcher.hasFile(".treeinfo"):
-                logging.debug("Detected .treeinfo file")
-                tmptreeinfo = fetcher.acquireFile(".treeinfo", progresscb)
-                self.treeinfo = ConfigParser.SafeConfigParser()
-                self.treeinfo.read(tmptreeinfo)
-                return True
-            else:
-                return False
-        else:
+        if not (self.treeinfo is None):
             return True
+
+        if not fetcher.hasFile(".treeinfo"):
+            return False
+
+        logging.debug("Detected .treeinfo file")
+
+        tmptreeinfo = fetcher.acquireFile(".treeinfo", progresscb)
+        try:
+            self.treeinfo = ConfigParser.SafeConfigParser()
+            self.treeinfo.read(tmptreeinfo)
+        finally:
+            os.unlink(tmptreeinfo)
+
+        return True
 
     def acquireKernel(self, fetcher, progresscb):
         if self.hasTreeinfo(fetcher, progresscb):




More information about the et-mgmt-tools mailing list