[open-ils-commits] r14009 - trunk/Open-ILS/src/support-scripts (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Sep 10 23:55:51 EDT 2009
Author: dbs
Date: 2009-09-10 23:55:49 -0400 (Thu, 10 Sep 2009)
New Revision: 14009
Modified:
trunk/Open-ILS/src/support-scripts/settings-tester.pl
Log:
Catch a few more common problems in settings-tester.pl:
* Check for <database> elements to ensure that Evergreen version of opensrf.xml is in place
* Check for oils_web.xml (required as of Evergreen 1.6)
Also, a bit of clean-up:
* Ensure all output is available to be gathered
* Short-circuit pointless database tests if the database connection fails
Modified: trunk/Open-ILS/src/support-scripts/settings-tester.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/settings-tester.pl 2009-09-10 18:21:50 UTC (rev 14008)
+++ trunk/Open-ILS/src/support-scripts/settings-tester.pl 2009-09-11 03:55:49 UTC (rev 14009)
@@ -96,6 +96,20 @@
print "\nChecking database connections\n";
# Check database connections
my @databases = $osrfxml->findnodes('//database');
+
+# If we have no database connections, this is probably the OpenSRF version
+# of opensrf.xml
+if (!@databases) {
+ my $de = "* WARNING: There are no database connections defined in " .
+ "opensrf.xml. These are defined in services such as " .
+ "open-ils.cstore and open-ils.reporter. Please ensure that " .
+ "your opensrf_core.xml and opensrf.xml configuration files " .
+ "are based on the examples shipped with Evergreen instead of " .
+ "OpenSRF.\n";
+ $output .= $de;
+ warn $de;
+}
+
foreach my $database (@databases) {
my $db_name = $database->findvalue("./db");
if (!$db_name) {
@@ -107,8 +121,12 @@
my $db_pw = $database->findvalue("./pw");
if (!$db_pw && $database->parentNode->parentNode->nodeName eq 'reporter') {
$db_pw = $database->findvalue("./password");
- warn "* WARNING: Deprecated <password> element used for the <reporter> entry. " .
- "Please use <pw> instead.\n" if ($db_pw);
+ if ($db_pw) {
+ my $de = "* WARNING: Deprecated <password> element used for the " .
+ "<reporter> entry. Please use <pw> instead.\n";
+ $output .= $de;
+ warn $de;
+ }
}
my $osrf_xpath;
@@ -190,7 +208,18 @@
$output .= $result;
}
+# Check for oils_web.xml, required for acquisitions and many administration
+# interfaces as of Evergreen 1.6
+if (!-t '/openils/conf/oils_web.xml') {
+ my $de = "* WARNING: As of Evergreen 1.6, /openils/conf/oils_web.xml " .
+ "is a required configuration file. Copying " .
+ "/openils/conf/oils_web.xml.example should resolve this " .
+ "problem.\n";
+ $output .= $de;
+ warn $de;
+}
+
if ($gather) {
get_debug_info( $tmpdir, $log_dir, $conf_dir, $perloutput, $output );
}
@@ -201,31 +230,29 @@
my $dsn = "dbi:Pg:dbname=$db_name;host=$db_host;port=$db_port";
my $de = undef;
my ($dbh, $encoding, $langs);
- try {
- $dbh = DBI->connect($dsn, $db_user, $db_pw);
- unless($dbh) {
- $de = "* $osrf_xpath :: Unable to connect to database $dsn, user=$db_user, password=$db_pw\n";
- warn "* $osrf_xpath :: Unable to connect to database $dsn, user=$db_user, password=$db_pw\n";
- }
+ $dbh = DBI->connect($dsn, $db_user, $db_pw);
- # Get server encoding
- my $sth = $dbh->prepare("SHOW server_encoding");
- $sth->execute;
- $sth->bind_col(1, \$encoding);
- $sth->fetch;
- $sth->finish;
+ # Short-circuit if we didn't connect successfully
+ unless($dbh) {
+ $de = "* $osrf_xpath :: Unable to connect to database $dsn, user=$db_user, password=$db_pw\n";
+ warn "* $osrf_xpath :: Unable to connect to database $dsn, user=$db_user, password=$db_pw\n";
+ return $de;
+ }
- # Get list of server languages
- $sth = $dbh->prepare("SELECT lanname FROM pg_catalog.pg_language");
- $sth->execute;
- $langs = $sth->fetchall_arrayref([0]);
- $sth->finish;
+ # Get server encoding
+ my $sth = $dbh->prepare("SHOW server_encoding");
+ $sth->execute;
+ $sth->bind_col(1, \$encoding);
+ $sth->fetch;
+ $sth->finish;
- $dbh->disconnect;
- } catch Error with {
- $de = "* $osrf_xpath :: Unable to connect to database $dsn, user=$db_user, password=$db_pw\n" . shift() . "\n";
- warn "* $osrf_xpath :: Unable to connect to database $dsn, user=$db_user, password=$db_pw\n" . shift() . "\n";
- };
+ # Get list of server languages
+ $sth = $dbh->prepare("SELECT lanname FROM pg_catalog.pg_language");
+ $sth->execute;
+ $langs = $sth->fetchall_arrayref([0]);
+ $sth->finish;
+
+ $dbh->disconnect;
print "* $osrf_xpath :: Successfully connected to database $dsn\n" unless ($de);
# Check encoding
More information about the open-ils-commits
mailing list