[open-ils-commits] r14408 - tags/rel_1_6_0_0/Open-ILS/src/support-scripts (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 13 21:31:45 EDT 2009


Author: dbs
Date: 2009-10-13 21:31:43 -0400 (Tue, 13 Oct 2009)
New Revision: 14408

Modified:
   tags/rel_1_6_0_0/Open-ILS/src/support-scripts/eg_db_config.pl
Log:
Merge r14405 from trunk: support state_store updates

Modified: tags/rel_1_6_0_0/Open-ILS/src/support-scripts/eg_db_config.pl
===================================================================
--- tags/rel_1_6_0_0/Open-ILS/src/support-scripts/eg_db_config.pl	2009-10-14 01:31:16 UTC (rev 14407)
+++ tags/rel_1_6_0_0/Open-ILS/src/support-scripts/eg_db_config.pl	2009-10-14 01:31:43 UTC (rev 14408)
@@ -3,7 +3,7 @@
 # vim:noet:ts=4:sw=4:
 #
 # Copyright (C) 2008 Equinox Software, Inc.
-# Copyright (C) 2008 Laurentian University
+# Copyright (C) 2008-2009 Laurentian University
 # Author: Kevin Beswick <kevinbeswick00 at gmail.com>
 # Author: Dan Scott <dscott at laurentian.ca>
 #
@@ -49,22 +49,21 @@
 		foreach my $service (@$services) {
 			foreach my $key (keys %$settings) {
 				next unless $settings->{$key};
-				my(@node) = $opensrf_config->findnodes("//$service//database/$key/text()");
-				foreach(@node) {
+				my @node;
+
+				if ($service eq 'state_store') {
+					(@node) = $opensrf_config->findnodes("//state_store/$key/text()");
+				} else {
+					(@node) = $opensrf_config->findnodes("//$service//database/$key/text()");
+				}
+
+				foreach (@node) {
 					$_->setData($settings->{$key});
 				}
 			}
 
 		}
 	}
-	else {
-		foreach my $key (keys %$settings) {
-			my(@node) = $opensrf_config->findnodes("//database/$key/text()");
-			foreach(@node) {
-				$_->setData($settings->{$key});
-			}
-		}
-	}
 
 	my $timestamp = sprintf("%d.%d.%d.%d.%d.%d",
 		$year + 1900, $mon +1, $mday, $hour, $min, $sec);
@@ -72,7 +71,7 @@
 		print "Backed up original configuration file to '$config_file.$timestamp'\n";
 	} else {
 		print STDERR "Unable to write to '$config_file.$timestamp'; bailed out.\n";
-    }
+	}
 
 	$opensrf_config->toFile($config_file) or
 		die "ERROR: Failed to update the configuration file '$config_file'\n";
@@ -82,7 +81,7 @@
 sub create_db_bootstrap {
 	my ($setup, $settings) = @_;
 
-    open(FH, '>', $setup) or die "Could not write database setup to $setup\n";
+	open(FH, '>', $setup) or die "Could not write database setup to $setup\n";
 
 	print "Writing database bootstrapping configuration to $setup\n";
 
@@ -93,14 +92,14 @@
 	printf FH "\$main::config{pw} = '%s';\n", $settings->{pw};
 	
 	print FH "\$main::config{index} = 'config.cgi';\n";
-    close(FH);
+	close(FH);
 }
 
 # write out the offline config
 sub create_offline_config {
 	my ($setup, $settings) = @_;
 
-    open(FH, '>', $setup) or die "Could not write offline database setup to $setup\n";
+	open(FH, '>', $setup) or die "Could not write offline database setup to $setup\n";
 
 	print "Writing offline database configuration to $setup\n";
 
@@ -113,7 +112,7 @@
 	printf FH "\$main::config{usr} = '%s';\n", $settings->{user};
 	printf FH "\$main::config{pw} = '%s';\n", $settings->{pw};
 
-    close(FH);
+	close(FH);
 }
 # Extracts database settings from opensrf.xml
 sub get_settings {
@@ -173,7 +172,7 @@
 );
 
 if (grep(/^all$/, @services)) {
-	@services = qw/reporter open-ils.cstore open-ils.pcrud open-ils.storage open-ils.reporter-store/;
+	@services = qw/reporter open-ils.cstore open-ils.pcrud open-ils.storage open-ils.reporter-store state_store/;
 }
 
 my $eg_config = File::Spec->catfile($script_dir, '../extras/eg_config');
@@ -266,6 +265,7 @@
             * open-ils.pcrud
             * open-ils.storage
             * open-ils.reporter-store
+            * state_store
     
 DATABASE CONFIGURATION OPTIONS
     --user            username for the database 



More information about the open-ils-commits mailing list