fix warn function

The warn function was putting content into a side log file which made
it kind of hard to keep an eye on when warnings were actually being
issued. Let's just get this into the main output stream.

The calling of the warn function in git_timed was also incorrect, so
the output would not have been what we expected. This solves that as
well.

This will hopefully give us trackable data about how often we need to
recover from git clone errors.

Change-Id: Iee0d2df7fb788a4d34044d29ab10afdcafb9bb5a
This commit is contained in:
Sean Dague 2015-04-28 08:57:57 -04:00
parent c9197f6c72
commit e4af92987a

View File

@ -174,10 +174,7 @@ function warn {
local xtrace=$(set +o | grep xtrace) local xtrace=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
local msg="[WARNING] ${BASH_SOURCE[2]}:$1 $2" local msg="[WARNING] ${BASH_SOURCE[2]}:$1 $2"
echo $msg 1>&2; echo $msg
if [[ -n ${LOGDIR} ]]; then
echo $msg >> "${LOGDIR}/error.log"
fi
$xtrace $xtrace
return $exitcode return $exitcode
} }
@ -509,7 +506,7 @@ function git_timed {
fi fi
count=$(($count + 1)) count=$(($count + 1))
warn "timeout ${count} for git call: [git $@]" warn $LINENO "timeout ${count} for git call: [git $@]"
if [ $count -eq 3 ]; then if [ $count -eq 3 ]; then
die $LINENO "Maximum of 3 git retries reached" die $LINENO "Maximum of 3 git retries reached"
fi fi