[rhmessaging-commits] rhmessaging commits: r1592 - mgmt/cumin/bin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Jan 21 10:04:34 EST 2008


Author: justi9
Date: 2008-01-21 10:04:34 -0500 (Mon, 21 Jan 2008)
New Revision: 1592

Modified:
   mgmt/cumin/bin/cumin
   mgmt/cumin/bin/cumin-database-init
Log:
bin/cumin: Adds a check for the message attr on exceptions.

bin/cumin-database-init: Insist the user is root.



Modified: mgmt/cumin/bin/cumin
===================================================================
--- mgmt/cumin/bin/cumin	2008-01-21 14:40:06 UTC (rev 1591)
+++ mgmt/cumin/bin/cumin	2008-01-21 15:04:34 UTC (rev 1592)
@@ -68,13 +68,13 @@
 try:
     sqlhub.getConnection().getConnection()
 except Exception, e:
-    if e.message.find("does not exist"):
+    if hasattr(e, "message") and e.message.find("does not exist"):
         print "Database not found; run cumin-database-init"
+        sys.exit(1)
     else:
-        print "Failed connecting to database; " + e.message
+        print "Failed connecting to database"
+        raise e
 
-    sys.exit(1)
-
 from wooly.server import WebServer
 from cumin import *
 

Modified: mgmt/cumin/bin/cumin-database-init
===================================================================
--- mgmt/cumin/bin/cumin-database-init	2008-01-21 14:40:06 UTC (rev 1591)
+++ mgmt/cumin/bin/cumin-database-init	2008-01-21 15:04:34 UTC (rev 1592)
@@ -7,6 +7,11 @@
     exit 2
 fi
 
+if [ "$EUID" -ne "0" ]; then
+    echo "This script must be run as root"
+    exit 2
+fi
+
 user="$1"
 
 if [ -z "$user" -o "$user" = "-" ]; then




More information about the rhmessaging-commits mailing list