diff options
author | Venky Shankar <venky@gluster.com> | 2011-09-13 22:11:33 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-20 10:32:55 -0700 |
commit | b30f66e20d830daec057075d67f181e904984a27 (patch) | |
tree | bd65582f16521ab909b23dd52ed4366b74b526eb /xlators/features/marker/utils/syncdaemon/syncdutils.py | |
parent | e8b81f72d7a45ce443e72c45ae68952911deac50 (diff) |
geo-rep: gsyncd: add --ignore-deletes option
When this option is set, a file deleted on master will not trigger
a delete operation on the slave. Hence, the slave will remain as a
superset of the master and can be used to recover the master in case
of crash and/or accidental deletes.
This options is not enabled by default.
Change-Id: I9244d9dfa4f38f19436036f36bec0d9c3a1f7993
BUG: 3552
Reviewed-on: http://review.gluster.com/426
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Csaba Henk <csaba@gluster.com>
Diffstat (limited to 'xlators/features/marker/utils/syncdaemon/syncdutils.py')
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/syncdutils.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/syncdutils.py b/xlators/features/marker/utils/syncdaemon/syncdutils.py index f82f412a0..e3098d5f4 100644 --- a/xlators/features/marker/utils/syncdaemon/syncdutils.py +++ b/xlators/features/marker/utils/syncdaemon/syncdutils.py @@ -222,3 +222,28 @@ def getusername(uid = None): if uid == None: uid = os.geteuid() return pwd.getpwuid(uid).pw_name + +def boolify(s): + """ + Generic string to boolean converter + + return + - Quick return if string 's' is of type bool + - True if it's in true_list + - False if it's in false_list + - Warn if it's not present in either and return False + """ + true_list = ['true', 'yes', '1', 'on'] + false_list = ['false', 'no', '0', 'off'] + + if isinstance(s, bool): + return s + + rv = False + lstr = s.lower() + if lstr in true_list: + rv = True + elif not lstr in false_list: + logging.warn("Unknown string (%s) in string to boolean conversion defaulting to False\n" % (s)) + + return rv |