diff --git a/scripts/bootstrap-server-sudo.sh b/scripts/bootstrap-server-sudo.sh index 970dfc4..fab80d2 100755 --- a/scripts/bootstrap-server-sudo.sh +++ b/scripts/bootstrap-server-sudo.sh @@ -2,7 +2,7 @@ # # Bootstrap sudoers.d config on server side before doing anything else! # -set -e +set -eo pipefail if [[ ${#} -lt 1 ]]; then echo "Usage: ${0} [OPTIONS] [SSH_USER@]SSH_SERVER" @@ -17,4 +17,4 @@ declare -r STDOUTERR=/tmp/xiringuito.$(basename ${0}).${USER} ssh -t -oStrictHostKeyChecking=no ${@} \ "sudo true && sudo bash -c \ \"umask 0337 && echo -e ${SUDO_NOTE}'\n'\${USER} ${SUDO_CONF} | tee ${BASE_NAME}-\${USER}\" >/dev/null" \ - &>${STDOUTERR} + &>${STDOUTERR} || (cat ${STDOUTERR} >>/dev/stderr && exit 1) diff --git a/xaval b/xaval index dbe5b03..7885afa 100755 --- a/xaval +++ b/xaval @@ -271,6 +271,8 @@ function wait_connection(){ local WAIT_TIME=0 while [[ "$(get_profile_status ${PROFILE})" != "UP" ]]; do if [[ ${WAIT_TIME} -ge ${WAIT_TIMEOUT} ]]; then + dump_profile_log ${PROFILE} + commit_suicide "Unable to bring up \"${PROFILE}\" after ${WAIT_TIMEOUT} seconds" fi @@ -303,6 +305,18 @@ function logs_profile() { echo "STATUS: $(get_profile_status ${PROFILE})" } +function dump_profile_log() { + local PROFILE=${1} + + suicide_on_absent_profile ${PROFILE} + + local LOG_FILE=${LOG_DIR}/${PROFILE} + + echo "--- LOG ---" >>/dev/stderr + cat ${LOG_FILE} >>/dev/stderr + echo "--- LOG ---" >>/dev/stderr +} + function rename_profile(){ local OLD_PROFILE=${1} local NEW_PROFILE=${2}