Merge "Quote error messages"

This commit is contained in:
Zuul 2018-10-10 13:01:04 +00:00 committed by Gerrit Code Review
commit a1ffc4f1eb

View File

@ -228,9 +228,9 @@ function err {
xtrace=$(set +o | grep xtrace) xtrace=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
local msg="[ERROR] ${BASH_SOURCE[2]}:$1 $2" local msg="[ERROR] ${BASH_SOURCE[2]}:$1 $2"
echo $msg 1>&2; echo "$msg" 1>&2;
if [[ -n ${LOGDIR} ]]; then if [[ -n ${LOGDIR} ]]; then
echo $msg >> "${LOGDIR}/error.log" echo "$msg" >> "${LOGDIR}/error.log"
fi fi
$xtrace $xtrace
return $exitcode return $exitcode
@ -283,7 +283,7 @@ function warn {
xtrace=$(set +o | grep xtrace) 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 echo "$msg"
$xtrace $xtrace
return $exitcode return $exitcode
} }
@ -1444,11 +1444,11 @@ function _common_systemd_pitfalls {
read -r -d '' msg << EOF || true # read returns 1 for EOF, but it is ok here read -r -d '' msg << EOF || true # read returns 1 for EOF, but it is ok here
You are trying to use run_process with sudo, this is not going to work under systemd. You are trying to use run_process with sudo, this is not going to work under systemd.
If you need to run a service as a user other than $STACK_USER call it with: If you need to run a service as a user other than \$STACK_USER call it with:
run_process \$name \$cmd \$group \$user run_process \$name \$cmd \$group \$user
EOF EOF
die $LINENO $msg die $LINENO "$msg"
fi fi
if [[ ! "$cmd" =~ ^/ ]]; then if [[ ! "$cmd" =~ ^/ ]]; then
@ -1458,7 +1458,7 @@ start under systemd.
Please update your run_process stanza to have an absolute path. Please update your run_process stanza to have an absolute path.
EOF EOF
die $LINENO $msg die $LINENO "$msg"
fi fi
} }