summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-04-11 04:09:17 +0000
committerAnand Avati <avati@gluster.com>2011-04-11 03:52:33 -0700
commit86a091ac0d46ce2b06b79ceafe728ee65fc6ebbf (patch)
tree650209d3f96e06d9d610177bcd626e55e8bfdfff /xlators
parent2f38fdac226b5b5bd02a78e9933ec46b05cac32d (diff)
syncdaemon: fix transaction code
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2659 (gsync config-del option is not working properly) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2659
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/marker/utils/syncdaemon/configinterface.py11
-rw-r--r--xlators/features/marker/utils/syncdaemon/syncdutils.py3
2 files changed, 7 insertions, 7 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/configinterface.py b/xlators/features/marker/utils/syncdaemon/configinterface.py
index a1079d80394..23526861fac 100644
--- a/xlators/features/marker/utils/syncdaemon/configinterface.py
+++ b/xlators/features/marker/utils/syncdaemon/configinterface.py
@@ -113,11 +113,11 @@ class GConffile(object):
def mergeconf(f):
self.config = ConfigParser.RawConfigParser()
self.config.readfp(f)
- def updateconf(f):
if not self.config.has_section(SECT_META):
self.config.add_section(SECT_META)
self.config.set(SECT_META, 'version', config_version)
- trfn(*a, **kw)
+ return trfn(*a, **kw)
+ def updateconf(f):
self.config.write(f)
syncdutils.update_file(self.path, updateconf, mergeconf)
@@ -130,16 +130,15 @@ class GConffile(object):
self.config.add_section(SECT_ORD)
self.config.set(SECT_ORD, sect, len(self.config._sections[SECT_ORD]))
self.config.set(sect, opt, val)
+ return True
def set(self, *a, **kw):
self.write(self._set, *a, **kw)
def _delete(self, opt, rx=False):
sect = self.section(rx)
- if not self.config.has_section(sect):
- return
- if self.config.remove_option(sect, opt):
- self.write()
+ if self.config.has_section(sect):
+ return self.config.remove_option(sect, opt)
def delete(self, *a, **kw):
self.write(self._delete, *a, **kw)
diff --git a/xlators/features/marker/utils/syncdaemon/syncdutils.py b/xlators/features/marker/utils/syncdaemon/syncdutils.py
index 5c17d0579b0..d3ab2f34507 100644
--- a/xlators/features/marker/utils/syncdaemon/syncdutils.py
+++ b/xlators/features/marker/utils/syncdaemon/syncdutils.py
@@ -24,7 +24,8 @@ def update_file(path, updater, merger = lambda f: True):
os.close(fd)
raise
fcntl.lockf(fr, fcntl.LOCK_EX)
- merger(fr)
+ if not merger(fr):
+ return
tmpp = path + '.tmp.' + str(os.getpid())
fd = os.open(tmpp, os.O_CREAT|os.O_EXCL|os.O_WRONLY)