Commit 510dbb29 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis

Support debug mode

If DEBUG=true in /etc/default/snf-network then all
commands will be logged (set -x) and stdout/stderr will
be redirected to /var/log/ganeti/snf-network.debug file.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent 09e9cce5
...@@ -37,11 +37,18 @@ source /etc/default/snf-network ...@@ -37,11 +37,18 @@ source /etc/default/snf-network
: ${STATE_DIR:=/var/lib/snf-network} : ${STATE_DIR:=/var/lib/snf-network}
: ${LOGFILE:=/var/log/ganeti/snf-network.log} : ${LOGFILE:=/var/log/ganeti/snf-network.log}
: ${DEBUGFILE:=/var/log/ganeti/snf-network.debug}
: ${DEBUG:=false}
if $DEBUG; then
set -x
exec &>>$DEBUGFILE
fi
function try { function try {
$1 &>/dev/null || true $1 || true
} }
...@@ -402,7 +409,7 @@ send_command () { ...@@ -402,7 +409,7 @@ send_command () {
fi fi
log "* $nsupdate_command" log "* $nsupdate_command"
log "* $command" log "* $command"
$nsupdate_command > /dev/null << EOF $nsupdate_command <<EOF
server $SERVER server $SERVER
$command $command
send send
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment