txzookeeper.lock.Lock problem when using chroot

Bug #921428 reported by Alex Parenteau
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
txzookeeper
New
Undecided
Unassigned

Bug Description

When using chroot (e.g. localhost::2181/myroot), there is a bug in the Lock implementation.

self._candidate_path will include the chroot portion (because it is set as a result of an async create, see _on_candidate_create).

So it will look like this:

/myroot/lockpatch/00000000.lock

For the release step to work, it needs to strip out the chroot:

diff --git a/pythonlib/thirdparty/txzookeeper/lock.py b/pythonlib/thirdparty/txzookeeper/lock.py
index 0ef52c8..d44ba54 100644
--- a/pythonlib/thirdparty/txzookeeper/lock.py
+++ b/pythonlib/thirdparty/txzookeeper/lock.py
@@ -139,7 +139,10 @@ class Lock(object):
             error = LockError("Not holding lock %s"%(self.path))
             return fail(error)

- d = self._client.delete(self._candidate_path)
+ # aparente: account for chroot
+ index = self._candidate_path.find(self._path)
+ candidate_path = self._candidate_path[index:]
+ d = self._client.delete(candidate_path)

         def on_delete_success(value):
             self._candidate_path = None

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.