From 201116ac3180225a90f7b313a5c65732791b60af Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 14 Mar 2011 08:43:13 +0100 Subject: [PATCH] Check if the file we want to remove exists If we have directory symlinks, some files could have already been removed and we get a traceback. This prevents the traceback. --- src/pylorax/yumhelper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pylorax/yumhelper.py b/src/pylorax/yumhelper.py index fae7622b..5f39222a 100644 --- a/src/pylorax/yumhelper.py +++ b/src/pylorax/yumhelper.py @@ -116,6 +116,10 @@ class LoraxYumHelper(object): fullpattern = joinpaths(self.installroot, pattern) count = 0 for fname in glob.glob(fullpattern): + # if there are symlinks, we could already removed the file + if not os.path.exists(fname): + continue + if os.path.islink(fname) or os.path.isfile(fname): os.unlink(fname) else: