From 8d862725719ea1cb11d480a2a641e2467a94753e Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Mon, 17 Sep 2018 17:52:30 +0200 Subject: [PATCH] TT#37257 Stop writing ngcp-installer-debug.log (it duplicates deployment-installer-debug.log) We have confusing situation for an ages here. We were writing a lot of log files: > /var/log/deployment-installer-debug.log > /var/log/ngcp-installer.log > /var/log/ngcp-installer-debug.log The first one contains all the GRML boot, Debian debootstrap and ngcp-installer-debug.log already. Also having both ngcp-installer.log and ngcp-installer-debug.log confuses new users as they do not know which logs they need to check first to see ngcp-installer logs. There is no need to keep both files anymore. Nowadays we have a nice way to distinguish logs between components, so /var/log/deployment-installer-debug.log is enough here: > +15:07:48 (netscript.grml:1403): main(): echo 'Generating ngcp-installer run script ...' > +15:07:48 (netscript.grml:1404): main(): cat > +15:07:48 (netscript.grml:1417): main(): echo 'Execute ngcp-installer inside deployment chroot environment ...' > ... > Running ngcp-installer via grml-chroot. > ... > +17:07:48 (ngcp-installer:27): main(): . /usr/share/ngcp-installer//system_pro.inc > +17:07:48 (ngcp-installer:28): main(): . /usr/share/ngcp-installer//packages.inc > +17:07:48 (ngcp-installer:31): main(): . /usr/share/ngcp-installer//cfg.inc > ... > +17:07:57 (packages.inc:58): packages_ppa_sourceslist(): echo '(system installed using NGCP PPA: gerrit_gtid_imp)' > +17:07:57 (ngcp-installer:54): main(): packages_aptconfig > +17:07:57 (packages.inc:90): packages_aptconfig(): mkdir -p /etc/apt/preferences.d > +17:07:57 (packages.inc:92): packages_aptconfig(): cat The commit here should minimize amount of log files we produce and should simplify the debug process. Change-Id: I26a2ca8e21a3385f7d57d830feb207bbb1039b39 --- templates/scripts/includes/deployment.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index 1a7938e..9d2a3c5 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -1403,13 +1403,13 @@ if "$NGCP_INSTALLER" ; then echo "Generating ngcp-installer run script ..." cat > "${TARGET}/tmp/ngcp-installer-deployment.sh" << "EOT" #!/bin/bash -echo "Running ngcp-installer via grml-chroot." | tee -a /tmp/ngcp-installer-debug.log -ngcp-installer 2>&1 | tee -a /tmp/ngcp-installer-debug.log -RC=${PIPESTATUS[0]} -if [ "${RC}" = "0" ] ; then - echo "OK, ngcp-installer finished with exit code '${RC}', continue netscript deployment." | tee -a /tmp/ngcp-installer-debug.log +echo "Running ngcp-installer via grml-chroot." +ngcp-installer 2>&1 +RC=$? +if [ "${RC}" = "0" ]; then + echo "OK, ngcp-installer finished successfully, continue netscript deployment." else - echo "ERROR: Fatal error while running ngcp-installer (exit code '${RC}')!" | tee -a /tmp/ngcp-installer-debug.log >&2 + echo "ERROR: Fatal error while running ngcp-installer (exit code '${RC}')!" exit ${RC} fi EOT @@ -1434,7 +1434,7 @@ EOT cp /etc/network/interfaces "${TARGET}/etc/network/" unset method netcardconf else - die "Error during installation of ngcp. Find details at: ${TARGET}/var/log/ngcp-installer.log ${TARGET}/tmp/ngcp-installer-debug.log" + die "Error during installation of ngcp. Find details at: ${TARGET}/var/log/ngcp-installer.log" fi echo "Temporary files cleanup ..." @@ -1442,10 +1442,7 @@ EOT :>$TARGET/var/run/utmp :>$TARGET/var/run/wtmp - echo "Backup of the installer logfiles for later investigation ..." - if [ -r "${TARGET}"/tmp/ngcp-installer-debug.log ] ; then - cp "${TARGET}"/tmp/ngcp-installer-debug.log "${TARGET}"/var/log/ - fi + echo "Backup grml-debootstrap.log for later investigation ..." if [ -r /tmp/grml-debootstrap.log ] ; then cp /tmp/grml-debootstrap.log "${TARGET}"/var/log/ fi