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

From: Novell Forge SVN <noreply_at_novell.com>
Date: Tue, 3 Mar 2009 13:19:41 -0700 (MST)
Author: poeml
Date: 2009-03-03 13:19:38 -0700 (Tue, 03 Mar 2009)
New Revision: 6675

Modified:
   trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
Log:
mb new:
- when a new mirror is created, automatically fill in AS number and prefix
- also add a little comment with a timestamp


Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-03-03 20:17:22 UTC (rev 6674)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-03-03 20:19:38 UTC (rev 6675)
@@ -133,7 +133,9 @@
         ${cmd_option_list}
         """
 
+        import time
         import urlparse
+        import mb.asn
 
 
         if not opts.http:
@@ -145,8 +147,11 @@
         if not opts.country:
             opts.country = mb.geoip.lookup_country_code(host)
 
+        r = mb.asn.iplookup(self.conn, host)
+        asn, prefix = r.asn, r.prefix
+
         if opts.region == '--' or opts.country == '--':
-            raise ValueError('region lookup failed')
+            raise ValueError('Region lookup failed. Use the -c and -r option.')
 
         s = self.conn.Server(identifier   = identifier,
                              baseurl      = opts.http,
@@ -154,8 +159,8 @@
                              baseurlRsync = opts.rsync or '',
                              region       = opts.region,
                              country      = opts.country,
-                             asn          = 0,
-                             prefix       = '',
+                             asn          = asn,
+                             prefix       = prefix,
                              score        = opts.score,
                              enabled      = 0,
                              statusBaseurl = 0,
@@ -165,7 +170,8 @@
                              operatorUrl  = '',
                              otherCountries = '',
                              publicNotes  = '',
-                             comment      = opts.comment or '',
+                             comment      = opts.comment \
+                               or 'Added - %s' % time.ctime(),
                              scanFpm      = 0,
                              countryOnly  = 0,
                              regionOnly   = 0,

_______________________________________________
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-03Z20:19:54

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