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

From: Novell Forge SVN <noreply_at_novell.com>
Date: Sat, 7 Mar 2009 06:50:57 -0700 (MST)
Author: poeml
Date: 2009-03-07 06:50:54 -0700 (Sat, 07 Mar 2009)
New Revision: 6738

Modified:
   trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
Log:
mb list:
- add new options to display further selected info about mirrors:
  --country --region --prefix --as --prio
  The --country conflicts a little with the previous -c|--country option
  to select mirrors; the latter is -c now, which is a little dumb.


Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-03-07 07:34:37 UTC (rev 6737)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-03-07 13:50:54 UTC (rev 6738)
@@ -181,15 +181,23 @@
             print s
 
 
-    #_at_cmdln.option('-s', '--show-score', action='store_true',
-    #                    help='show score of each mirror')
+    @cmdln.option('--country', action='store_true',
+                        help='also display the country')
+    @cmdln.option('--region', action='store_true',
+                        help='also display the region')
+    @cmdln.option('--prefix', action='store_true',
+                        help='also display the network prefix')
+    @cmdln.option('--as', action='store_true',
+                        help='also display the AS')
+    @cmdln.option('--prio', action='store_true',
+                        help='also display priorities')
     @cmdln.option('--disabled', action='store_true',
                         help='show only disabled mirrors')
     @cmdln.option('-a', '--show-disabled', action='store_true',
                         help='do not hide disabled mirrors')
-    @cmdln.option('-c', '--country', metavar='XY',
+    @cmdln.option('-c', metavar='XY',
                         help='show only mirrors whose country matches XY')
-    @cmdln.option('-r', '--region', metavar='XY',
+    @cmdln.option('-r', metavar='XY',
                         help='show only mirrors whose region matches XY '
                         '(possible values: sa,na,oc,af,as,eu)')
     # @cmdln.alias('ls') ?
@@ -200,9 +208,9 @@
             mirrordoctor list [IDENTIFIER]
         ${cmd_option_list}
         """
-        if opts.country:
+        if opts.c:
             mirrors = self.conn.Server.select("""country LIKE '%%%s%%'""" % opts.country)
-        elif opts.region:
+        elif opts.r:
             mirrors = self.conn.Server.select("""region LIKE '%%%s%%'""" % opts.region)
         elif args:
             mirrors = mb.conn.servers_match(self.conn.Server, args[0])
@@ -210,14 +218,28 @@
             mirrors = self.conn.Server.select()
 
         for mirror in mirrors:
+            s = []
+            s.append('%-30s' % mirror.identifier)
+            if opts.prio:
+                s.append('%3s' % mirror.score)
+            if opts.region:
+                s.append('%2s' % mirror.region)
+            if opts.country:
+                s.append('%2s' % mirror.country)
+            if opts.as:
+                s.append('%5s' % mirror.asn)
+            if opts.prefix:
+                s.append('%-19s' % mirror.prefix)
+            s = ' '.join(s)
+
             if opts.show_disabled:
-                print mirror.identifier #, mirror.score
+                print s
             elif opts.disabled:
                 if not mirror.enabled:
-                    print mirror.identifier #, mirror.score
+                    print s
             else:
                 if mirror.enabled:
-                    print mirror.identifier #, mirror.score
+                    print s
 
 
     def do_show(self, subcmd, opts, identifier):

_______________________________________________
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-07Z13:51:30

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