summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/utils
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-09-22 10:12:24 +0200
committerVijay Bellur <vijay@gluster.com>2011-09-22 05:24:57 -0700
commit21eabe9bae81b3cc732fcf773fb5c1995f19d0d7 (patch)
tree3b259c119d6139f50f9d7a141827bb0750e53615 /xlators/features/marker/utils
parentb27b9d36de798bb18eaa95524f3900f9e17ce3e5 (diff)
geo-rep: add support to glob patterns with "geo-rep config"
Change-Id: I0d54cea72e4363eab85ade774cc918081d8036e9 BUG: 3610 Reviewed-on: http://review.gluster.com/489 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/features/marker/utils')
-rw-r--r--xlators/features/marker/utils/syncdaemon/gsyncd.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py
index f3b5988ade0..67a873cb57c 100644
--- a/xlators/features/marker/utils/syncdaemon/gsyncd.py
+++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py
@@ -9,6 +9,7 @@ import signal
import select
import optparse
import fcntl
+import fnmatch
from optparse import OptionParser, SUPPRESS_HELP
from logging import Logger
from errno import EEXIST, ENOENT
@@ -177,7 +178,7 @@ def main_i():
op.add_option('--config-' + a, metavar='OPT', type=str, dest='config', action='callback',
callback=store_local_obj(a, lambda vx: {'opt': vx}))
op.add_option('--config-get-all', dest='config', action='callback', callback=store_local_obj('get', lambda vx: {'opt': None}))
- for m in ('', '-rx'):
+ for m in ('', '-rx', '-glob'):
# call this code 'Pythonic' eh?
# have to define a one-shot local function to be able to inject (a value depending on the)
# iteration variable into the inner lambda
@@ -186,7 +187,7 @@ def main_i():
callback=store_local_obj('set', lambda vx: {'opt': vx[0], 'val': vx[1], 'rx': rx}))
op.add_option('--config-del' + m, metavar='OPT', type=str, dest='config', action='callback',
callback=store_local_obj('del', lambda vx: {'opt': vx, 'rx': rx}))
- conf_mod_opt_regex_variant(not not m)
+ conf_mod_opt_regex_variant(m and m[1:] or False)
op.add_option('--normalize-url', dest='url_print', action='callback', callback=store_local_curry('normal'))
op.add_option('--canonicalize-url', dest='url_print', action='callback', callback=store_local_curry('canon'))
@@ -226,8 +227,11 @@ def main_i():
raise GsyncdError('tunable %s is not set to value %s required for restricted SSH invocaton' % \
(k, v))
- if getattr(confdata, 'rx', None):
+ confrx = getattr(confdata, 'rx', None)
+ if confrx:
# peers are regexen, don't try to parse them
+ if confrx == 'glob':
+ args = [ '\A' + fnmatch.translate(a) for a in args ]
canon_peers = args
namedict = {}
else: