Author: tmckay Date: 2011-03-28 13:10:54 +0000 (Mon, 28 Mar 2011) New Revision: 4670
Modified: trunk/cumin/bin/cumin-database trunk/cumin/etc/sysvinit-cumin Log: Add a "noadvice" undocumented argument to cumin-database check so that if/when detailed output is given from /etc/init.d/cumin, the user is not confused by advice from a particular check routine. The correct thing for them to do is run cumin-database install and delegate responsibility for fixes to that script if at all possible; this is how the init.d script instructs them.
Modified: trunk/cumin/bin/cumin-database =================================================================== --- trunk/cumin/bin/cumin-database 2011-03-28 01:54:09 UTC (rev 4669) +++ trunk/cumin/bin/cumin-database 2011-03-28 13:10:54 UTC (rev 4670) @@ -39,7 +39,9 @@
rpm -q postgresql-server &> /dev/null || { echo "Error: postgresql-server is not installed" - echo "Hint: Run 'yum install postgresql-server'" + if [ "$1" != noadvice ]; then + echo "Hint: Run 'yum install postgresql-server'" + fi return 1 } } @@ -47,7 +49,9 @@ function check-started { /sbin/service postgresql status &> /dev/null || { echo "Error: The database is not running" - echo "Hint: Run 'cumin-database start'" + if [ "$1" != noadvice ]; then + echo "Hint: Run 'cumin-database start'" + fi return 1 } } @@ -55,7 +59,9 @@ function check-initialized { if [[ ! -f "$pghbaconf" ]]; then echo "Error: The database is not initialized" - echo "Hint: Run 'cumin-database initialize'" + if [ "$1" != noadvice ]; then + echo "Hint: Run 'cumin-database initialize'" + fi return 1 fi } @@ -63,7 +69,9 @@ function check-configured { grep "$dbname" "$pghbaconf" &> /dev/null || { echo "Error: The database is not configured" - echo "Hint: Run 'cumin-database configure'" + if [ "$1" != noadvice ]; then + echo "Hint: Run 'cumin-database configure'" + fi return 1 } } @@ -71,7 +79,9 @@ function check-created { psql -d cumin -U cumin -h localhost -c '\q' &> /dev/null || { echo "Error: The database is not created" - echo "Hint: Run 'cumin-database create'" + if [ "$1" != noadvice ]; then + echo "Hint: Run 'cumin-database create'" + fi return 1 } } @@ -303,23 +313,23 @@ case "$1" in check) echo -n "Checking environment ........ " - check-environment || exit 1 + check-environment $2 || exit 1 echo "OK"
echo -n "Checking initialization ..... " - check-initialized || exit 1 + check-initialized $2 || exit 1 echo "OK"
echo -n "Checking configuration ...... " - check-configured || exit 1 + check-configured $2 || exit 1 echo "OK"
echo -n "Checking server ............. " - check-started || exit 1 + check-started $2 || exit 1 echo "OK"
echo -n "Checking database 'cumin' ... " - check-created || exit 1 + check-created $2 || exit 1 echo "OK"
echo "The database is ready"
Modified: trunk/cumin/etc/sysvinit-cumin =================================================================== --- trunk/cumin/etc/sysvinit-cumin 2011-03-28 01:54:09 UTC (rev 4669) +++ trunk/cumin/etc/sysvinit-cumin 2011-03-28 13:10:54 UTC (rev 4670) @@ -26,7 +26,7 @@ echo "Run 'cumin-database install' as root"
echo "(detailed output from cumin-database check:)" - cumin-database check + cumin-database check noadvice exit 1 }