summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/utils/syncdaemon/gsyncd.py
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-03-10 00:40:05 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-10 07:39:17 -0800
commit50492481a2b1e5a1425598fb44d802ec047f6c2f (patch)
tree1c0ef7ab1a13e31fa707b76ba484f1c0e8471802 /xlators/features/marker/utils/syncdaemon/gsyncd.py
parentcbdf22d79ada40e483583a4277aba2faaa769892 (diff)
syncdaemon: add support from dumping urls in canonical and escaped canonical form
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
Diffstat (limited to 'xlators/features/marker/utils/syncdaemon/gsyncd.py')
-rw-r--r--xlators/features/marker/utils/syncdaemon/gsyncd.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py
index d8166baea..9d0b00095 100644
--- a/xlators/features/marker/utils/syncdaemon/gsyncd.py
+++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py
@@ -207,6 +207,8 @@ def main_i():
store_local(o, oo, (vx, False, False), p))
op.add_option('--config-del-rx', metavar='OPT', type=str, dest='config', action='callback', callback=lambda o, oo, vx, p:
store_local(o, oo, (vx, False, True), p))
+ op.add_option('--canonicalize-url', dest='do_canon', action='callback', callback=store_local_curry('raw'))
+ op.add_option('--canonicalize-escape-url', dest='do_canon', action='callback', callback=store_local_curry('escaped'))
# precedence for sources of values: 1) commandline, 2) cfg file, 3) defaults
# -- for this to work out we need to tell apart defaults from explicitly set
@@ -215,7 +217,10 @@ def main_i():
defaults = op.get_default_values()
opts, args = op.parse_args(values=optparse.Values())
confdata = rconf.get('config')
- if not (len(args) == 2 or (len(args) == 1 and rconf.get('listen')) or (len(args) <= 2 and confdata)):
+ if not (len(args) == 2 or \
+ (len(args) == 1 and rconf.get('listen')) or \
+ (len(args) <= 2 and confdata) or \
+ rconf.get('do_canon')):
sys.stderr.write("error: incorrect number of arguments\n\n")
sys.stderr.write(op.get_usage() + "\n")
sys.exit(1)
@@ -224,11 +229,17 @@ def main_i():
# peers are regexen, don't try to parse them
canon_peers = args
else:
+ rscs = [resource.parse_url(u) for u in args]
+ dc = rconf.get('do_canon')
+ if dc:
+ for r in rscs:
+ print(r.get_url(canonical=True, escaped=(dc=='escaped')))
+ return
local = remote = None
- if args:
- local = resource.parse_url(args[0])
- if len(args) > 1:
- remote = resource.parse_url(args[1])
+ if rscs:
+ local = rscs[0]
+ if len(rscs) > 1:
+ remote = rscs[1]
if not local.can_connect_to(remote):
raise RuntimeError("%s cannot work with %s" % (local.path, remote and remote.path))
pa = ([], [])