remove /var/lib/yum, /var/cache/yum in target image
authorJF Ding <jian-feng.ding@intel.com>
Wed, 12 Oct 2011 09:11:10 +0000 (17:11 +0800)
committerJF Ding <jian-feng.ding@intel.com>
Wed, 12 Oct 2011 09:11:10 +0000 (17:11 +0800)
no used for current supported images which using zypp
merge back from mic2

mic/imager/baseimager.py

index 6791f19..f210cf4 100644 (file)
@@ -685,12 +685,20 @@ class BaseImageCreator(object):
 
             if self.qemu_emulator:
                 os.unlink(self._instroot + self.qemu_emulator)
+        except OSError:
+            pass
 
-            """ Clean up yum garbage """
+        """ Clean up yum garbage """
+        try:
             instroot_pdir = os.path.dirname(self._instroot + self._instroot)
             if os.path.exists(instroot_pdir):
                 shutil.rmtree(instroot_pdir, ignore_errors = True)
-
+            yumcachedir = self._instroot + "/var/cache/yum"
+            if os.path.exists(yumcachedir):
+                shutil.rmtree(yumcachedir, ignore_errors = True)
+            yumlibdir = self._instroot + "/var/lib/yum"
+            if os.path.exists(yumlibdir):
+                shutil.rmtree(yumlibdir, ignore_errors = True)
         except OSError:
             pass