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
This commit is contained in:
Sorin Sbarnea 2018-08-21 09:51:04 +01:00
parent 101074b2e8
commit 7612e52810
2 changed files with 27 additions and 9 deletions

View File

@ -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 -- <<SUDO
mkdir -p /opt/stack/new
if [ -d $LOGS_DIR/undercloud/home/$USER/tempest ]; then
cp -Rf $LOGS_DIR/undercloud/home/$USER/tempest /opt/stack/new
fi
if [ -d /opt/stack/new/tempest/.testrepository ]; then
gzip -d -r /opt/stack/new/tempest/.testrepository
fi
SUDO
# record the size of the logs directory
# -L, --dereference dereference all symbolic links

View File

@ -123,7 +123,9 @@ function create_collect_logs_script {
/usr/bin/timeout --preserve-status 40m $QUICKSTART_COLLECTLOGS_CMD > $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 -- <<SUDO
mkdir -p /opt/stack/new
if [ -d $LOGS_DIR/undercloud/home/$USER/tempest ]; then
cp -Rf $LOGS_DIR/undercloud/home/$USER/tempest /opt/stack/new
fi
if [ -d /opt/stack/new/tempest/.testrepository ]; then
gzip -d -r /opt/stack/new/tempest/.testrepository
fi
SUDO
# record the size of the logs directory
# -L, --dereference dereference all symbolic links