Fix error when removing a symbolic link to a dir
This commit is contained in:
parent
45c5ef566c
commit
f96f015593
@ -107,10 +107,10 @@ class LoraxYumHelper(object):
|
|||||||
fullpattern = joinpaths(self.installroot, pattern)
|
fullpattern = joinpaths(self.installroot, pattern)
|
||||||
count = 0
|
count = 0
|
||||||
for fname in glob.glob(fullpattern):
|
for fname in glob.glob(fullpattern):
|
||||||
if os.path.isdir(fname):
|
if os.path.islink(fname) or os.path.isfile(fname):
|
||||||
shutil.rmtree(fname)
|
|
||||||
else:
|
|
||||||
os.unlink(fname)
|
os.unlink(fname)
|
||||||
|
else:
|
||||||
|
shutil.rmtree(fname)
|
||||||
|
|
||||||
logger.debug("removed {0}".format(fname))
|
logger.debug("removed {0}".format(fname))
|
||||||
count += 1
|
count += 1
|
||||||
|
Loading…
Reference in New Issue
Block a user