From e498b47d53a0a291250d4968d6e96a87f539eef7 Mon Sep 17 00:00:00 2001 From: downtownallday Date: Tue, 9 Jun 2020 22:06:25 -0400 Subject: [PATCH] Dump /var/log/syslog when start.sh fails --- .../assets/system-setup/remote-nextcloud-docker.sh | 8 ++++++-- tests/assets/system-setup/setup-funcs.sh | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/assets/system-setup/remote-nextcloud-docker.sh b/tests/assets/system-setup/remote-nextcloud-docker.sh index 96117767..d269d49e 100755 --- a/tests/assets/system-setup/remote-nextcloud-docker.sh +++ b/tests/assets/system-setup/remote-nextcloud-docker.sh @@ -60,6 +60,7 @@ before_miab_install() { update_hosts_for_private_ip || die "Could not update /etc/hosts" # update package lists before installing anything + H2 "apt-get update" apt-get update || die "apt-get update failed!" # install prerequisites @@ -87,10 +88,10 @@ before_miab_install() { # enable the remote Nextcloud setup mod, which tells MiaB-LDAP to use # the remote Nextcloud for calendar and contacts instead of the # MiaB-installed one + H2 "Create setup/mod.d/remote-nextcloud.sh symbolic link" if [ ! -e "setup/mods.d/remote-nextcloud.sh" ]; then ln -s "../mods.available/remote-nextcloud.sh" "setup/mods.d/remote-nextcloud.sh" || die "Could not create remote-nextcloud.sh symlink" fi - # install Docker H2 "Install Docker" @@ -100,7 +101,10 @@ before_miab_install() { miab_install() { H1 "MIAB-LDAP INSTALL" - setup/start.sh -v || die "setup/start.sh failed!" + if ! setup/start.sh; then + dump_log "/var/log/syslog" 200 + die "setup/start.sh failed!" + fi } diff --git a/tests/assets/system-setup/setup-funcs.sh b/tests/assets/system-setup/setup-funcs.sh index b5768b1a..7f64da49 100755 --- a/tests/assets/system-setup/setup-funcs.sh +++ b/tests/assets/system-setup/setup-funcs.sh @@ -17,6 +17,19 @@ H2() { echo "*** $msg ***" } +dump_log() { + local log_file="$1" + local lines="$2" + local title="DUMP OF $log_file" + if [ ! -z "$lines" ]; then + H1 "$title (last $lines lines)" + tail -$lines "$log_file" + else + H1 "$title" + tail "$log_file" + fi +} + install_qa_prerequisites() { # python3-dnspython: is used by the python scripts in 'tests' and is # not installed by setup