[rhmessaging-commits] rhmessaging commits: r1578 - in mgmt: cumin-test-0 and 1 other directories.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Fri Jan 18 17:15:42 EST 2008
Author: justi9
Date: 2008-01-18 17:15:42 -0500 (Fri, 18 Jan 2008)
New Revision: 1578
Added:
mgmt/cumin-test-0/etc/
mgmt/cumin-test-0/etc/cumin.conf
mgmt/cumin-test-0/sql
Modified:
mgmt/cumin/bin/cumin
mgmt/cumin/bin/cumin-database-init
Log:
Fixes up the test instance to work with the standard server start
script.
Steps toward a working db init script.
Modified: mgmt/cumin/bin/cumin
===================================================================
--- mgmt/cumin/bin/cumin 2008-01-18 22:04:29 UTC (rev 1577)
+++ mgmt/cumin/bin/cumin 2008-01-18 22:15:42 UTC (rev 1578)
@@ -16,9 +16,18 @@
def load_args(argv):
args = dict()
+ sconf = os.path.expandvars("${CUMIN_HOME}/etc/cumin.conf")
+ hconf = os.path.expanduser("~/.cumin.conf")
+
conf = SafeConfigParser()
- conf.read(os.path.expanduser("~/.cumin.conf"))
+ rconfs = conf.read((sconf, hconf))
+ if rconfs:
+ print "Config files read:"
+
+ for name in rconfs:
+ print " " + name
+
if (conf.has_section("main")):
for key, value in conf.items("main"):
args[key] = value
@@ -34,10 +43,10 @@
key = None
if args:
- print "Parameters:"
+ print "Config parameters set:"
for key in args:
- print " %10s %s" % (key, args[key])
+ print " " + key + " " + args[key]
return args
@@ -53,6 +62,16 @@
print "No data source"
usage()
+try:
+ sqlhub.getConnection().getConnection()
+except Exception, e:
+ if e.message.find("does not exist"):
+ print "Database not found; run cumin-database-init"
+ else:
+ print "Failed connecting to database; " + e.message
+
+ 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-18 22:04:29 UTC (rev 1577)
+++ mgmt/cumin/bin/cumin-database-init 2008-01-18 22:15:42 UTC (rev 1578)
@@ -1,16 +1,39 @@
-#!/bin/bash -v
+#!/bin/bash
# This script assumes that postgresql is configured and running
-if [ "$#" -lt 3 ]; then
- echo "Usage: mint-database-init USER-NAME DATABASE-NAME SCHEMA-FILE"
+if [ "$1" = "-h" -o "$1" = "--help" ]; then
+ echo "Usage: cumin-database-init [USER-NAME] [DATABASE-NAME] [SCHEMA-FILE]"
exit 2
fi
user="$1"
+
+if [ -z "$user" -o "$user" = "-" ]; then
+ user="cumin"
+fi
+
db="$2"
+
+if [ -z "$db" -o "$db" = "-" ]; then
+ db="cumin"
+fi
+
schema="$3"
+if [ -z "$schema" -o "$schema" = "-" ]; then
+ if [ -z "$CUMIN_HOME" ]; then
+ CUMIN_HOME=/usr/share/cumin
+ fi
+
+ schema="${CUMIN_HOME}/sql/schema.sql"
+fi
+
+if [ ! -f "$schema" ]; then
+ echo "Schema file '$schema' not found"
+ exit 2
+fi
+
su postgres -c "createuser --superuser ${user}"
su postgres -c "createdb --owner=${user} ${db}"
-su "$user" -c "psql -d ${db} -f ${schema}"
+psql -U "$user" -d "$db" -f "$schema"
Added: mgmt/cumin-test-0/etc/cumin.conf
===================================================================
--- mgmt/cumin-test-0/etc/cumin.conf (rev 0)
+++ mgmt/cumin-test-0/etc/cumin.conf 2008-01-18 22:15:42 UTC (rev 1578)
@@ -0,0 +1,3 @@
+[main]
+data: postgresql://cumin@localhost/cumin
+port: 9090
Added: mgmt/cumin-test-0/sql
===================================================================
--- mgmt/cumin-test-0/sql (rev 0)
+++ mgmt/cumin-test-0/sql 2008-01-18 22:15:42 UTC (rev 1578)
@@ -0,0 +1 @@
+link ../mint/sql
\ No newline at end of file
Property changes on: mgmt/cumin-test-0/sql
___________________________________________________________________
Name: svn:special
+ *
More information about the rhmessaging-commits
mailing list