TT#158650 Improve error reporting for failing action 'build'

Otherwise 'ngcpcfg apply' silently aborted on stage 'build'
and error message is not visible due to long/parallel output.

Change-Id: I34b2c14fecad33526d89939e62d85dbafab31535
mr10.3.1
Alexander Lutay 4 years ago
parent c519d8dcd0
commit 59f691b673

@ -55,6 +55,7 @@ build_config_files_instances() {
local target
local instance
local inst_cfg
local rc=0
if [ -z "${TEMPLATE_INSTANCES:-}" ] || [ ! -f "${TEMPLATE_INSTANCES}" ] ; then
log_debug "no template info for instances, skip step"
@ -68,19 +69,35 @@ build_config_files_instances() {
target=${info[1]}
instance=${info[2]}
log_debug "source:${source} target:${target} instance:${instance}"
log_debug "${RUNNER} ${HELPER}/instance-info ${instance}"
${RUNNER} "${HELPER}/instance-info" "${instance}" > "${inst_cfg}"
log_debug "${RUNNER} ${HELPER}/instance-info ${instance} > ${inst_cfg}"
${RUNNER} "${HELPER}/instance-info" "${instance}" > "${inst_cfg}" || rc=$?
if [ "${rc}" != "0" ]; then
log_error "Failed to build instance info! Aborting."
exit $rc
fi
log_debug "INSTANCE_NAME=${instance} ${RUNNER} ${HELPER}/tt2-process ${ARGS[*]} -c ${inst_cfg} -r ${source}:${target} ${source}"
INSTANCE_NAME="${instance}" ${RUNNER} "${HELPER}/tt2-process" "${ARGS[@]}" -c "${inst_cfg}" -r "${source}:${target}" "${source}"
INSTANCE_NAME="${instance}" ${RUNNER} "${HELPER}/tt2-process" "${ARGS[@]}" -c "${inst_cfg}" -r "${source}:${target}" "${source}" || rc=$?
if [ "${rc}" != "0" ]; then
log_error "Instances build errors detected (see the output above)! Aborting."
exit $rc
fi
done< <(${RUNNER} "${HELPER}/instances-info" "$@")
rm -f "${inst_cfg}"
}
build_config_files() {
RUNNER="nice -n 19 ionice -c 3"
local rc=0
log_debug "${RUNNER} ${HELPER}/tt2-process ${ARGS[*]} $*"
${RUNNER} "${HELPER}/tt2-process" "${ARGS[@]}" "$@"
${RUNNER} "${HELPER}/tt2-process" "${ARGS[@]}" "$@" || rc=$?
if [ "${rc}" != "0" ]; then
log_error "Build errors detected (see the output above)! Aborting."
exit $rc
fi
build_config_files_instances "$@"

Loading…
Cancel
Save