Add check for expected hostname in <hosts> section.
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 1 Nov 2007 23:52:32 +0000 (23:52 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 1 Nov 2007 23:52:32 +0000 (23:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7967 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/support-scripts/settings-tester.pl

index a9e01b5..25303de 100755 (executable)
@@ -88,6 +88,9 @@ print "\nChecking database connections\n";
 my @databases = $osrfxml->findnodes('//database');
 foreach my $database (@databases) {
        my $db_name = $database->findvalue("./db");     
+       if (!$db_name) {
+               $db_name = $database->findvalue("./name");      
+       }
        my $db_host = $database->findvalue("./host");   
        my $db_port = $database->findvalue("./port");   
        my $db_user = $database->findvalue("./user");   
@@ -147,9 +150,29 @@ foreach my $driver_node (@drivers) {
        $output .= $result;
 }
 
-
+print "\nChecking libdbi and libdbi-drivers\n";
 $output .= check_libdbd();
 
+print "\nChecking hostname\n";
+my @hosts = $osrfxml->findnodes('/opensrf/hosts/*');
+foreach my $host (@hosts) {
+       next unless $host->nodeType == XML::LibXML::XML_ELEMENT_NODE;
+       my $osrfhost = $host->nodeName;
+       my $he;
+       if ($osrfhost ne $hostname && $osrfhost ne "localhost") {
+               $result = " * ERROR: expected hostname '$hostname', found '$osrfhost' in <hosts> section of opensrf.xml\n";
+               warn $result;
+               $he = 1;
+       } elsif ($osrfhost eq "localhost") {
+               $result = " * OK: found hostname 'localhost' in <hosts> section of opensrf.xml\n";
+       } else {
+               $result = " * OK: found hostname '$hostname' in <hosts> section of opensrf.xml\n";
+       }
+       print $result unless $he;
+       $output .= $result;
+}
+
+
 if ($gather) {
        get_debug_info( $tmpdir, $log_dir, $conf_dir, $perloutput, $output );
 }