Merge "build: remove link to failed log before creating" into stable/rocky

This commit is contained in:
Zuul 2019-12-04 14:30:36 +00:00 committed by Gerrit Code Review
commit 9070cac280
1 changed files with 9 additions and 3 deletions

View File

@ -1037,9 +1037,15 @@ class KollaWorker(object):
'status': status,
})
if self.conf.logs_dir and status == STATUS_ERROR:
os.symlink("%s.log" % name,
os.path.join(self.conf.logs_dir,
"000_FAILED_%s.log" % name))
linkname = os.path.join(self.conf.logs_dir,
"000_FAILED_%s.log" % name)
try:
os.lstat(linkname)
os.remove(linkname)
except OSError:
pass
os.symlink("%s.log" % name, linkname)
if self.image_statuses_unmatched:
LOG.debug("=====================================")