[rhmessaging-commits] rhmessaging commits: r4351 - in mgmt/newdata/cumin: etc and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Sep 27 13:55:18 EDT 2010


Author: justi9
Date: 2010-09-27 13:55:18 -0400 (Mon, 27 Sep 2010)
New Revision: 4351

Modified:
   mgmt/newdata/cumin/bin/cumin-database
   mgmt/newdata/cumin/etc/sysvinit-cumin
Log:
For bz 632592, in the init script, first check that postgresql is
running.

Before dropping the database, issue a warning and get explicit
confirmation.


Modified: mgmt/newdata/cumin/bin/cumin-database
===================================================================
--- mgmt/newdata/cumin/bin/cumin-database	2010-09-27 17:31:00 UTC (rev 4350)
+++ mgmt/newdata/cumin/bin/cumin-database	2010-09-27 17:55:18 UTC (rev 4351)
@@ -99,8 +99,16 @@
 If, however, none of these changes affect your existing deployment, it
 is safe to proceed.
 
-Enter 'yes' to proceed or Ctrl-C to cancel:
 EOF
+
+    get-explicit-confirmation
+
+    install
+}
+
+function get-explicit-confirmation {
+    echo "Enter 'yes' to proceed or Ctrl-C to cancel:"
+
     while read word; do
         if [[ "$word" == "yes" ]]; then
             break
@@ -108,8 +116,6 @@
 
         echo "Enter 'yes' to proceed or Ctrl-C to cancel:"
     done
-
-    install
 }
 
 function install {
@@ -207,6 +213,19 @@
     run "dropuser ${dbname}" postgres
 }
 
+function confirm-drop {
+    cat <<EOF
+WARNING
+
+This operation will discard the contents of the cumin database.
+
+EOF
+
+    get-explicit-confirmation
+
+    drop
+}
+
 function confirm-annihilate {
     check-environment || exit 1
 
@@ -265,6 +284,9 @@
 
         echo "The database is ready"
         ;;
+    check-started)
+        check-started || exit 1
+        ;;
     install)
         confirm-install
         echo "The database is installed"
@@ -290,7 +312,7 @@
         echo "The database is created"
         ;;
     drop)
-        drop
+        confirm-drop
         echo "The database is dropped"
         ;;
     annihilate)

Modified: mgmt/newdata/cumin/etc/sysvinit-cumin
===================================================================
--- mgmt/newdata/cumin/etc/sysvinit-cumin	2010-09-27 17:31:00 UTC (rev 4350)
+++ mgmt/newdata/cumin/etc/sysvinit-cumin	2010-09-27 17:55:18 UTC (rev 4351)
@@ -11,6 +11,12 @@
 test -x /usr/bin/cumin || exit 1
 test -x /usr/bin/cumin-database || exit 1
 
+cumin-database check-started &> /dev/null || {
+    echo "Cumin's database server is not running"
+    echo "Run 'cumin-database start' as root"
+    exit 1
+}
+
 cumin-database check &> /dev/null || {
     echo "Cumin's database is not yet installed"
     echo "Run 'cumin-database install' as root"



More information about the rhmessaging-commits mailing list