From d2dd104043f263beea372ced48b394374e0a8ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Mon, 7 May 2018 15:55:59 +0200 Subject: [PATCH] Create symlinks for failed builds logs This allows to know which image failed to build without having to parse the huge job-output.txt file. This commit creates a convenient 000_FAILED_image_name.log symlink to the relevant log files when kolla is configured to output to a log directory. This creates symlinks only for the parent image with error, i.e. it skips images that failed to build because of parent error. Change-Id: I05954e2335dc3fac469276809c91f9c87e3ecab2 (cherry picked from commit 58742c212e0bdc5092ba6cc0da2fc8c5589bb172) --- kolla/image/build.py | 4 ++++ tests/playbooks/post.yml | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/kolla/image/build.py b/kolla/image/build.py index 7fd6fd714e..ec8a3cd393 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -800,6 +800,10 @@ class KollaWorker(object): 'name': name, '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)) if self.image_statuses_unmatched: LOG.debug("=====================================") diff --git a/tests/playbooks/post.yml b/tests/playbooks/post.yml index 345ccab041..864b6e87f4 100644 --- a/tests/playbooks/post.yml +++ b/tests/playbooks/post.yml @@ -62,6 +62,12 @@ sudo mv $f ${f/.log/.txt} done + # Update symlinks to new file names + for f in $(find logs -name "*FAILED*"); do + sudo mv ${f} ${f}.gz + sudo ln -sf ${f#*/000_FAILED_}.gz ${f}.gz + done + # append .txt to all kolla config file find logs/kolla_configs -type f -exec mv '{}' '{}'.txt \;