summaryrefslogtreecommitdiff
path: root/obnamlib/repo_interface.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-08-29 20:20:57 +0300
committerLars Wirzenius <liw@liw.fi>2015-08-29 20:20:57 +0300
commit5ef4654c89983eba9ab9780fe54a550f52a1d2b1 (patch)
tree03a66e6d4f3fec07033678cadea4d86492d4f5bf /obnamlib/repo_interface.py
parente934763e8788a0aad50b2871b05bbf5182b89f81 (diff)
parent83f034d85c6a787a9c8a7f755b14a97edfb6c32d (diff)
downloadobnam-5ef4654c89983eba9ab9780fe54a550f52a1d2b1.tar.gz
Merge Lukas's changes to unlock if gpg fails
Conflicts: obnamlib/__init__.py
Diffstat (limited to 'obnamlib/repo_interface.py')
-rw-r--r--obnamlib/repo_interface.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py
index c618217a..361c33c9 100644
--- a/obnamlib/repo_interface.py
+++ b/obnamlib/repo_interface.py
@@ -394,22 +394,30 @@ class RepositoryInterface(object):
'''
unlockers = []
+ gpg_unlockers = []
try:
if not self.got_client_list_lock():
+ gpg_unlockers.append((self.unlock_client_list, []))
self.lock_client_list()
unlockers.append((self.unlock_client_list, []))
for client_name in self.get_client_names():
if not self.got_client_lock(client_name):
+ gpg_unlockers.append((self.unlock_client, [client_name]))
self.lock_client(client_name)
unlockers.append((self.unlock_client, [client_name]))
if not self.got_chunk_indexes_lock():
+ gpg_unlockers.append((self.unlock_chunk_indexes, []))
self.lock_chunk_indexes()
except obnamlib.LockFail:
for unlocker, args in unlockers:
unlocker(*args)
raise
+ except obnamlib.GpgError:
+ for unlocker, args in gpg_unlockers:
+ unlocker(*args)
+ raise
def unlock_everything(self):
'''Unock every part of the repository to which we hold a lock.