fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-10-04 11:22 am

[dw-free] admin/healthy.bml does not indicate whether schwartz is reachable

[commit: http://hg.dwscoalition.org/dw-free/rev/658726fda070]

http://bugs.dwscoalition.org/show_bug.cgi?id=3104

Connect to the schwartz database and check whether we have tables.

Patch by [personal profile] exor674.

Files modified:
  • htdocs/admin/healthy.bml
--------------------------------------------------------------------------------
diff -r ea9975d3f902 -r 658726fda070 htdocs/admin/healthy.bml
--- a/htdocs/admin/healthy.bml	Mon Oct 04 18:52:32 2010 +0800
+++ b/htdocs/admin/healthy.bml	Mon Oct 04 19:21:41 2010 +0800
@@ -94,6 +94,28 @@
         }
     }
 
+    if ( ! LJ::theschwartz() ) {
+        # no schwartz
+    } elsif ( scalar( grep { defined $_->{role} } @LJ::THESCHWARTZ_DBS ) > 0 || scalar( @LJ::THESCHWARTZ_DBS ) > 1 ) {
+        # cannot test, leaving off
+    } else {
+        my $sid = 0;
+        foreach my $db ( @LJ::THESCHWARTZ_DBS ) {
+            my $s_db = DBI->connect( $db->{dsn}, $db->{user}, $db->{pass} );
+            if ( $s_db ) {
+                my $time = $s_db->selectrow_array( "DESCRIBE " . ( $db->{prefix} ? $db->{prefix}."_job" : "job" ) );
+                if ( ! $time || $s_db->err ) {
+                    push @fail, "schwartz $sid";
+                } else {
+                    push @pass, "schwartz $sid";
+                }
+            } else {
+                push @fail, "schwartz $sid unreachable";
+            }
+            $sid++;
+        }
+    }
+
     # print results
     BML::set_content_type( 'text/plain' );
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org