From 7612e5281087553a544e3be49600fd463af964ca Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 21 Aug 2018 09:51:04 +0100 Subject: [PATCH] Avoid ignoring failure to collect missing folders Makes output easier to read by avoiding errors related to missing folders. Keep in mind that log collection happens even for failed builds so missing files are to be expected and not a reason to create warnings. Collection should create warnings only if it encounters something unexpected. Partial-Bug: #1787912 Change-Id: I5c40e531c06389e9707c0db33d6aaa5baea0ddea --- .../templates/oooq_common_functions.sh.j2 | 16 +++++++++++---- scripts/oooq_common_functions.sh | 20 ++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/roles/run-test/templates/oooq_common_functions.sh.j2 b/roles/run-test/templates/oooq_common_functions.sh.j2 index 6b024d2e5..952e684d0 100644 --- a/roles/run-test/templates/oooq_common_functions.sh.j2 +++ b/roles/run-test/templates/oooq_common_functions.sh.j2 @@ -116,13 +116,21 @@ elif [[ -e $LOGS_DIR/undercloud/home/$USER/undercloud_sanity.subunit.gz ]]; then fi # Copy tempest.html to root dir -cp $LOGS_DIR/undercloud/home/$USER/tempest/tempest.html.gz ${LOGS_DIR} || true +if [ -f $LOGS_DIR/undercloud/home/$USER/tempest/tempest.html.gz ]; then + cp $LOGS_DIR/undercloud/home/$USER/tempest/tempest.html.gz ${LOGS_DIR} +fi # Copy tempest and .testrepository directory to /opt/stack/new/tempest and # unzip -sudo mkdir -p /opt/stack/new -sudo cp -Rf $LOGS_DIR/undercloud/home/$USER/tempest /opt/stack/new || true -sudo gzip -d -r /opt/stack/new/tempest/.testrepository || true +sudo -s -- < $LOGS_DIR/quickstart_collect_logs.log || \ echo "WARNING: quickstart collect-logs failed, check quickstart_collectlogs.log for details" - cp $LOGS_DIR/undercloud/var/log/postci.txt.gz $LOGS_DIR/ || true + if [ -f $LOGS_DIR/undercloud/var/log/postci.txt.gz ]; then + cp $LOGS_DIR/undercloud/var/log/postci.txt.gz $LOGS_DIR/ + fi if [[ -e $LOGS_DIR/undercloud/home/$USER/tempest/testrepository.subunit.gz ]]; then cp $LOGS_DIR/undercloud/home/$USER/tempest/testrepository.subunit.gz ${LOGS_DIR}/testrepository.subunit.gz @@ -134,13 +136,21 @@ function create_collect_logs_script { fi # Copy tempest.html to root dir - cp $LOGS_DIR/undercloud/home/$USER/tempest/tempest.html.gz ${LOGS_DIR} || true + if [ -f $LOGS_DIR/undercloud/home/$USER/tempest/tempest.html.gz ]; then + cp $LOGS_DIR/undercloud/home/$USER/tempest/tempest.html.gz ${LOGS_DIR} + fi # Copy tempest and .testrepository directory to /opt/stack/new/tempest and # unzip - sudo mkdir -p /opt/stack/new - sudo cp -Rf $LOGS_DIR/undercloud/home/$USER/tempest /opt/stack/new || true - sudo gzip -d -r /opt/stack/new/tempest/.testrepository || true + sudo -s -- <