Author: poeml Date: Wed Aug 12 19:22:26 2009 New Revision: 7757 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=7757 Log: mb export: - implement generation of a mirmon file (or rather, a mirror list to be included in one). Modified: trunk/mirrordoctor/mb/exports.py trunk/mirrordoctor/mirrordoctor.py Modified: trunk/mirrordoctor/mb/exports.py ============================================================================== --- trunk/mirrordoctor/mb/exports.py Wed Aug 12 02:50:49 2009 (r7756) +++ trunk/mirrordoctor/mb/exports.py Wed Aug 12 19:22:26 2009 (r7757) @@ -58,3 +58,4 @@ """ +mirmon_template = """%(proto)s\t%(region)s\t%(url)s\t%(adminEmail)s""" Modified: trunk/mirrordoctor/mirrordoctor.py ============================================================================== --- trunk/mirrordoctor/mirrordoctor.py Wed Aug 12 02:50:49 2009 (r7756) +++ trunk/mirrordoctor/mirrordoctor.py Wed Aug 12 19:22:26 2009 (r7757) @@ -1015,7 +1015,7 @@ @cmdln.option('--target-dir', metavar='PATH', help='For the "vcs" output format, specify a target directory to place files into') @cmdln.option('--format', metavar='FORMAT', - help='Specify the output format: [django|postgresql|vcs]') + help='Specify the output format: [django|postgresql|mirmon|vcs]') def do_export(self, subcmd, opts, *args): """${cmd_name}: export the mirror list as text file @@ -1026,6 +1026,9 @@ Format "postgresql" is suitable to be imported into a PostgreSQL database. + Format "mirmon" creates a list of mirrors to be included in a mirmon + configuration. + Format "vcs" generates a file tree which can be imported/committed into a version control system (VCS). This can be used to periodically dump the database into a working copy of such a repository and commit the @@ -1062,6 +1065,9 @@ elif opts.format == 'postgresql': print mb.exports.postgresql_header + elif opts.format == 'mirmon': + pass + elif opts.format == 'vcs': import os, os.path if not os.path.exists(opts.target_dir): @@ -1098,6 +1104,17 @@ elif opts.format == 'postgresql': print mb.exports.postgresql_template % d + elif opts.format == 'mirmon': + for proto, urlname in [('http', 'baseurl'), + ('ftp', 'baseurlFtp'), + ('rsync', 'baseurlRsync')]: + if d[urlname]: + print mb.exports.mirmon_template \ + % dict(proto=proto, + url=d[urlname], + adminEmail=d['adminEmail'], + region=d['region']) + elif opts.format == 'vcs': s = mb.conn.server_show_template % mb.conn.server2dict(m) s = '\n'.join([ i for i in s.splitlines() if not i.startswith('statusBaseurl') ]) + '\n' _______________________________________________ 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.orgReceived on Wed Aug 12 2009 - 17:22:28 GMT
This archive was generated by hypermail 2.2.0 : Wed Aug 12 2009 - 17:45:07 GMT