Author: poeml Date: Wed Sep 1 00:09:23 2010 New Revision: 8082 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8082&view=rev Log: rsyncinfo: - This script is easier to use now. Instead of the arkward syntax it now also takes simple rsync URLs. Before: rsyncinfo size gd.tuwien.ac.at -m openoffice Now: rsyncinfo size gd.tuwien.ac.at::openoffice rsyncinfo size rsync://gd.tuwien.ac.at/openoffice Modified: trunk/tools/rsyncinfo.py Modified: trunk/tools/rsyncinfo.py URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/tools/rsyncinfo.py?rev=8082&r1=8081&r2=8082&view=diff ============================================================================== --- trunk/tools/rsyncinfo.py (original) +++ trunk/tools/rsyncinfo.py Wed Sep 1 00:09:23 2010 _at_@ -107,9 +107,29 @@ opts.modules = self.read_module_list(host) mod_maxlen = 0 - for mod in opts.modules: - if len(mod) > mod_maxlen: - mod_maxlen = len(mod) + if opts.modules: + for mod in opts.modules: + if len(mod) > mod_maxlen: + mod_maxlen = len(mod) + else: + if host.startswith('rsync://'): + host = host[8:] + + + # note: this parsing doesn't cater for embedded credentials + if '::' in host: + mod = host[host.find('::')+2 :] + host = host[:host.find('::')] + elif '/' in host: + mod = host[host.find('/')+1 :] + host = host[:host.find('/')] + else: + sys.exit('if -m is not used, the host string must contain a path (e.g. rsync URL)') + print host, mod + + opts.modules = [mod] + mod_maxlen = len(mod) + template = '%%-%ds %%10s' % mod_maxlen for mod in opts.modules: _______________________________________________ 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 Tue Aug 31 2010 - 22:09:28 GMT
This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT