PR#2372: TaskManager: clean both result and results dirs

Merges #2372
https://pagure.io/koji/pull-request/2372

Fixes: #1988
https://pagure.io/koji/issue/1988
kojid should also cleanup any 'bootstrap' repos
This commit is contained in:
Mike McLean 2020-07-21 23:29:19 -04:00
commit a04f6413b8

View file

@ -767,10 +767,13 @@ class TaskManager(object):
self.logger.info("%s: clearing rootdir" % desc2)
for fn in flist:
safe_rmtree("%s/%s" % (rootdir, fn), unmount=True, strict=False)
resultdir = "%s/result" % d
if os.path.isdir(resultdir):
self.logger.info("%s: clearing resultdir" % desc2)
safe_rmtree(resultdir, unmount=True, strict=False)
# bootstrap's resultdir is 'results', so we try the best to remove both
# 'result(s)' dirs
for r in ('result', 'results'):
resultdir = "%s/%s" % (d, r)
if os.path.isdir(resultdir):
self.logger.info("%s: clearing resultdir: %s" % (desc2, resultdir))
safe_rmtree(resultdir, unmount=True, strict=False)
else:
self.logger.debug("Recent buildroot: %s: %i seconds" % (desc, age))
self.logger.debug("Local buildroots: %d" % len(local_br))