build: remove link to failed log before creating
Kolla allows to create separate logs per image. It also makes very
useful symlinks to those builds which fail.
But it fails to do that on next builds:
ERROR:kolla.common.utils:aodh-base Failed with status: error
Traceback (most recent call last):
File "./tools/build.py", line 40, in <module>
sys.exit(main())
File "./tools/build.py", line 30, in main
statuses = build.run_build()
File "/home/hrw/devel/kolla/kolla/image/build.py", line 1333, in run_build
results = kolla.summary()
File "/home/hrw/devel/kolla/kolla/image/build.py", line 1037, in summary
"000_FAILED_%s.log" % name))
FileExistsError: [Errno 17] File exists: 'aodh-base.log' -> 'logs/debian-source-buster/000_FAILED_aodh-base.log'
Change-Id: I85132bbace63c8b386f69ddb758a3b52e52c0ef0
(cherry picked from commit 5792c1d7b4
)
This commit is contained in:
parent
77b664315d
commit
8e4c908b4c
|
@ -1037,9 +1037,15 @@ class KollaWorker(object):
|
||||||
'status': status,
|
'status': status,
|
||||||
})
|
})
|
||||||
if self.conf.logs_dir and status == STATUS_ERROR:
|
if self.conf.logs_dir and status == STATUS_ERROR:
|
||||||
os.symlink("%s.log" % name,
|
linkname = os.path.join(self.conf.logs_dir,
|
||||||
os.path.join(self.conf.logs_dir,
|
"000_FAILED_%s.log" % name)
|
||||||
"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:
|
if self.image_statuses_unmatched:
|
||||||
LOG.debug("=====================================")
|
LOG.debug("=====================================")
|
||||||
|
|
Loading…
Reference in New Issue