[mirrorbrain-commits] r8116 - in /trunk: mb/mb.py mb/mb/testmirror.py tools/scanner.pl

From: <poeml_at_mirrorbrain.org>
Date: Mon, 06 Sep 2010 15:38:21 -0000
Author: poeml
Date: Mon Sep  6 17:38:17 2010
New Revision: 8116

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8116&view=rev
Log:
mb scan:
- When using mb scan --enable, to enable a mirror after scanning, it is
  counter-intuitive that redirection to the mirror isn't immediately available.
  The mirrorprobe first needs to mark the online. The scan tool now does this
  right away. This has repeatedly make people wonder. Fixing issue 59.

Modified:
    trunk/mb/mb.py
    trunk/mb/mb/testmirror.py
    trunk/tools/scanner.pl

Modified: trunk/mb/mb.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb.py?rev=8116&r1=8115&r2=8116&view=diff
==============================================================================
--- trunk/mb/mb.py (original)
+++ trunk/mb/mb.py Mon Sep  6 17:38:17 2010
_at_@ -475,9 +475,10 @@
         """
 
         mirror = lookup_mirror(self, identifier)
-        print mirror.baseurl
         import mb.testmirror
-        print mb.testmirror.access_http(mirror.baseurl)
+        r = mb.testmirror.access_http(mirror.identifier, mirror.baseurl)
+        print r
+        print 'content: %r...' % r.content[:240]
 
 
     _at_cmdln.option('--content', action='store_true',
_at_@ -855,9 +856,20 @@
 
         if opts.enable and rc == 0:
             import time
-            comment = ('*** scanned and enabled at %s.' % (time.ctime()))
+            import mb.testmirror
+            tt = time.ctime()
+            comment = ('*** scanned and enabled at %s.' % tt)
             for mirror in mirrors_to_scan:
                 mirror.comment = ' '.join([mirror.comment or '', '\n\n' + comment])
+
+                print '%s %s: testing status of base URL...' % (tt, mirror.identifier)
+                t = mb.testmirror.access_http(mirror.identifier, mirror.baseurl)
+                if t.http_code == 200:
+                    mirror.statusBaseurl = 1
+                    print '%s %s: OK. Mirror is online now.' % (tt, mirror.identifier)
+                else:
+                    print '%s %s: Error: base URL does not work: %s' \
+                            % (tt, mirror.identifier, mirror.baseurl)
 
         sys.stdout.flush()
         if opts.directory and len(mirrors_skipped):

Modified: trunk/mb/mb/testmirror.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/testmirror.py?rev=8116&r1=8115&r2=8116&view=diff
==============================================================================
--- trunk/mb/mb/testmirror.py (original)
+++ trunk/mb/mb/testmirror.py Mon Sep  6 17:38:17 2010
_at_@ -12,11 +12,11 @@
 
 socket.setdefaulttimeout(TIMEOUT)
 
-def access_http(url):
-    from mb.util import Sample
-    S = Sample('', url, '', get_content=True)
+def access_http(identifier, url):
+    from mb.util import Sample
+    S = Sample(identifier, url, '', get_content=True)
     probe(S)
-    return S.content
+    return S
 
 
 def dont_use_proxies():

Modified: trunk/tools/scanner.pl
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/tools/scanner.pl?rev=8116&r1=8115&r2=8116&view=diff
==============================================================================
--- trunk/tools/scanner.pl (original)
+++ trunk/tools/scanner.pl Mon Sep  6 17:38:17 2010
_at_@ -366,7 +366,7 @@
     print "$sql\n" if $sqlverbose;
     my $sth = $dbh->prepare( $sql );
     $sth->execute() or die "$row->{identifier}: $DBI::errstr";
-    print "$row->{identifier}: now enabled.\n" if $verbose > 0;
+    print localtime(time) . " $row->{identifier}: now enabled.\n" if $verbose > 0;
   }
 
   $sql = "DROP TABLE temp1";




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Mon Sep 06 2010 - 15:38:28 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT