|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
VERBOSE=no
|
|
|
|
|
|
|
|
|
|
# do not rely on hostname(1), might return hostname of the
|
|
|
|
|
# deployment system when initially deploying via chroot
|
|
|
|
|
if [ -r /etc/hostname ] ; then
|
|
|
|
@ -62,10 +64,10 @@ fi
|
|
|
|
|
running_on_active_node() {
|
|
|
|
|
if [ -x /usr/sbin/ngcp-check_active ] ; 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
|
|
|
|
|
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
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
@ -84,11 +86,12 @@ apply_revision() {
|
|
|
|
|
echo done
|
|
|
|
|
else
|
|
|
|
|
echo "failed. :("
|
|
|
|
|
echo "Please resolve the problem and run ngcp-update-db-schema again."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
echo "Error while executing DB commands using revision $rev for host $hostname" >&2
|
|
|
|
|
exit 1
|
|
|
|
|