logging improvements, be not so verbose by default

0.1
Andrew Pogrebennyk 14 years ago
parent b6d98c7999
commit a6ff560d8a

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
VERBOSE=no
# do not rely on hostname(1), might return hostname of the # do not rely on hostname(1), might return hostname of the
# deployment system when initially deploying via chroot # deployment system when initially deploying via chroot
if [ -r /etc/hostname ] ; then if [ -r /etc/hostname ] ; then
@ -62,10 +64,10 @@ fi
running_on_active_node() { running_on_active_node() {
if [ -x /usr/sbin/ngcp-check_active ] ; then if [ -x /usr/sbin/ngcp-check_active ] ; then
if /usr/sbin/ngcp-check_active -q ; then if /usr/sbin/ngcp-check_active -q ; then
echo "This seems to be the active node, nothing to do." [ "$VERBOSE" != no ] && echo "This seems to be the active node, nothing to do."
return 0 return 0
else else
echo "This seems to be the inactive node, applying revisions." [ "$VERBOSE" != no ] && echo "This seems to be the inactive node, applying revisions."
return 1 return 1
fi fi
else else
@ -84,11 +86,12 @@ apply_revision() {
echo done echo done
else else
echo "failed. :(" echo "failed. :("
echo "Please resolve the problem and run ngcp-update-db-schema again."
exit 1 exit 1
fi fi
if mysql -usipwise -p${SIPWISE_DB_PASSWORD} ngcp -e "insert into db_schema values (0, '${revname}', \""${hostname}"\", CURRENT_TIMESTAMP);" ; then if mysql -usipwise -p${SIPWISE_DB_PASSWORD} ngcp -e "insert into db_schema values (0, '${revname}', \""${hostname}"\", CURRENT_TIMESTAMP);" ; then
echo "Marked revision $rev as applied." [ "$VERBOSE" != no ] && echo "Marked revision $rev as applied."
else else
echo "Error while executing DB commands using revision $rev for host $hostname" >&2 echo "Error while executing DB commands using revision $rev for host $hostname" >&2
exit 1 exit 1

Loading…
Cancel
Save