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.
This commit is contained in:
Martin Gracik 2011-03-14 08:43:13 +01:00
parent b368672429
commit 201116ac31

View File

@ -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: