diff options
| author | Marcin Juszkiewicz <marcin@juszkiewicz.com.pl> | 2018-10-23 17:00:19 +0200 |
|---|---|---|
| committer | Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | 2018-10-25 21:55:07 +0200 |
| commit | 5792c1d7b44737f1f39bb1a81b0c95207ad087ad (patch) | |
| tree | 98fc652d423e15fd642334d055fa1dc2513bdab8 /kolla | |
| parent | f613ff8a548accee65bd86209e4683539b66ffdb (diff) | |
| download | kolla-5792c1d7b44737f1f39bb1a81b0c95207ad087ad.tar.gz kolla-5792c1d7b44737f1f39bb1a81b0c95207ad087ad.zip | |
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
Diffstat (limited to 'kolla')
| -rwxr-xr-x | kolla/image/build.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py index 9b41dd3a6..a2c1ecc86 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -1032,9 +1032,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("=====================================") |
