[mirrorbrain-commits] [opensuse-svn] r6536 - in trunk/tools/download-redirector-v2/mirrordoctor: . mb

From: Novell Forge SVN <noreply_at_novell.com>
Date: Sun, 22 Feb 2009 06:16:49 -0700 (MST)
Author: poeml
Date: 2009-02-22 06:16:46 -0700 (Sun, 22 Feb 2009)
New Revision: 6536

Modified:
   trunk/tools/download-redirector-v2/mirrordoctor/mb/asn.py
   trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
Log:
mb tool: 
- handle DNS lookup errors when updating mirrors with network data


Modified: trunk/tools/download-redirector-v2/mirrordoctor/mb/asn.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mb/asn.py	2009-02-22 12:51:51 UTC (rev 6535)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mb/asn.py	2009-02-22 13:16:46 UTC (rev 6536)
_at_@ -11,8 +11,13 @@
         import sys, socket
         # note the difference between socket.gethostbyname 
         # and socket.gethostbyname_ex
-        host, aliases, ips = socket.gethostbyname_ex(s)
+        try:
+            host, aliases, ips = socket.gethostbyname_ex(s)
+        except socket.error, e:
+            print str(e)
+            return None
 
+
         #print host, aliases, ips
         if len(ips) != 1:
             print >>sys.stderr, \

Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-02-22 12:51:51 UTC (rev 6535)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-02-22 13:16:46 UTC (rev 6536)
_at_@ -186,6 +186,7 @@
     _at_cmdln.option('-r', '--region', metavar='XY',
                         help='show only mirrors whose region matches XY '
                         '(possible values: sa,na,oc,af,as,eu)')
+    # _at_cmdln.alias('ls') ?
     def do_list(self, subcmd, opts, *args):
         """${cmd_name}: list mirrors
 
_at_@ -265,13 +266,15 @@
     _at_cmdln.option('-a', '--asn', action='store_true',
                         help='update the AS number')
     def do_update(self, subcmd, opts, *args):
-        """${cmd_name}: update mirrors in the database
+        """${cmd_name}: update mirrors network data in the database
 
         Requires a pfx2asn table to be present, which can be used to look
         up the AS (autonomous system) number and the closest network prefix
         that an IP is contained in.
         Such a table is probably used in conjunction with mod_asn.
 
+        The IP to be looked up is derived from the HTTP base URL.
+
         ${cmd_usage}
         ${cmd_option_list}
         """
_at_@ -301,12 +304,13 @@
                                  self.conn.Server.q.enabled))
 
         for mirror in mirrors:
+            print mirror.identifier, 
             hostname = hostname_from_url(mirror.baseurl)
             res = iplookup(self.conn, hostname)
-            print mirror.identifier, res
-            if opts.prefix:
+            if res: print res
+            if res and opts.prefix:
                 mirror.prefix = res.prefix
-            if opts.asn:
+            if res and opts.asn:
                 mirror.asn = res.asn
 
 

_______________________________________________
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 Sun Feb 22 2009 - 13:17:23 GMT

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