diff options
author | Lukáš Poláček <lukas@ksp.sk> | 2015-07-21 23:29:45 +0200 |
---|---|---|
committer | Lukáš Poláček <lukas@ksp.sk> | 2015-08-05 19:29:36 +0200 |
commit | 83f034d85c6a787a9c8a7f755b14a97edfb6c32d (patch) | |
tree | 35a983fd83f2adf0760da86f37a6551b8f69aca7 /obnamlib/repo_interface.py | |
parent | b186a2182172facf50c8186559008bab90c19b12 (diff) | |
download | obnam-83f034d85c6a787a9c8a7f755b14a97edfb6c32d.tar.gz |
Unlock repository after GPG error
Diffstat (limited to 'obnamlib/repo_interface.py')
-rw-r--r-- | obnamlib/repo_interface.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py index 7c00a0fe..afc8b0c2 100644 --- a/obnamlib/repo_interface.py +++ b/obnamlib/repo_interface.py @@ -371,22 +371,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. |