[mirrorbrain-commits] [opensuse-svn] r6694 - trunk/tools/download-redirector-v2/mirrordoctor

From: Novell Forge SVN <noreply_at_novell.com>
Date: Wed, 4 Mar 2009 10:36:45 -0700 (MST)
Author: poeml
Date: 2009-03-04 10:36:43 -0700 (Wed, 04 Mar 2009)
New Revision: 6694

Modified:
   trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
Log:
mb file:
- files looked up in the database can now be probed for, and the response
  displayed, optionally md5 hash of the downloaded content.
  This can be used to check functionality of the mirrors.


Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-03-04 17:34:31 UTC (rev 6693)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-03-04 17:36:43 UTC (rev 6694)
@@ -679,6 +679,12 @@
             mb.vacuum.vacuum(self.conn)
 
 
+    @cmdln.option('-u', '--url', action='store_true',
+                        help='show the URL on the mirror')
+    @cmdln.option('-p', '--probe', action='store_true',
+                        help='probe the file')
+    @cmdln.option('--md5', action='store_true',
+                        help='show md5 hash of probed file')
     @cmdln.option('-m', '--mirror', 
                   help='apply operation to this mirror')
     def do_file(self, subcmd, opts, action, path):
@@ -708,6 +714,7 @@
             path = path[1:]
 
         import mb.files
+        import mb.testmirror
 
         if action in ['add', 'rm']:
             if not opts.mirror:
@@ -722,15 +729,29 @@
             rows = mb.files.ls(self.conn, path)
 
             for row in rows:
+                
                 if not mirror or (str(mirror.identifier) == row['identifier']):
-                    print '%s %s %4d %s %s %-30s %s%s' % \
+                    if opts.probe:
+                        (response, md5) = mb.testmirror.req(row['baseurl'],
+                                                            path,
+                                                            do_digest=opts.md5)
+                    else:
+                        response = '   '
+                    print '%s %s %4d %s %s %-30s ' % \
                             (row['region'].lower(), row['country'].lower(),
                              row['score'], 
                              row['enabled'] == 1 and 'ok      ' or 'disabled',
                              row['status_baseurl'] == 1 and 'ok  ' or 'dead',
-                             row['identifier'], 
-                             row['baseurl'], row['path'])
+                             row['identifier']),
+                    if opts.probe:
+                        print '%3s' % response,
+                    if opts.md5 and opts.probe:
+                        print md5,
+                    if opts.url:
+                        print row['baseurl'] + row['path'],
+                    print
 
+
         elif action == 'add':
             mb.files.add(self.conn, path, mirror)
 

_______________________________________________
Opensuse-svn mailing list
Opensuse-svn_at_forge.novell.com
http://forge.novell.com/mailman/listinfo/opensuse-svn


_______________________________________________
mirrorbrain-commits mailing list

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 2009-03-04Z17:37:04

This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:12 GMT