summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-12-30 16:48:13 +0100
committerLars Wirzenius <liw@liw.fi>2012-12-30 16:48:13 +0100
commit7cb8c14d75ef35721c99c8354e9fa21d85b613c5 (patch)
treecd4924b6109c9964a1848e7041523d86bec02ed5
parentb8761283e9aaafd1c2285e35e51db5ac2e0f18e9 (diff)
downloadobnam-7cb8c14d75ef35721c99c8354e9fa21d85b613c5.tar.gz
Clarify what happens when unlocking due to error
-rw-r--r--NEWS3
-rw-r--r--obnamlib/plugins/backup_plugin.py12
2 files changed, 11 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index b4bd7f02..221ab32e 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,9 @@ Bug fixes:
object has no attribute 'st_ino'` in an error message or log file.
* A bug in a restore crashing when failing to set extended attributes
on the restored file was fixed. Reported by "S. B.".
+* Made it clearer what is happening when unlocking the repository due to
+ errors, and fixed it so that a failure to unlock is also an error.
+ Reported by andrewsh.
Version 1.3, released 2012-12-16
--------------------------------
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index 57363afe..9279d748 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -320,15 +320,19 @@ class BackupPlugin(obnamlib.ObnamPlugin):
def unlock_when_error(self):
try:
if self.repo.got_client_lock:
- logging.info('Unlocking client because of error')
+ logging.info('Attempting to unlock client because of error')
self.repo.unlock_client()
if self.repo.got_shared_lock:
- logging.info('Unlocking shared trees because of error')
+ logging.info(
+ 'Attempting to unlock shared trees because of error')
self.repo.unlock_shared()
except BaseException, e2:
- logging.debug('Got second exception while unlocking: %s' %
- str(e2))
+ logging.error(
+ 'Error while unlocking due to error: %s' % str(e2))
logging.debug(traceback.format_exc())
+ raise
+ else:
+ logging.info('Successfully unlocked')
def add_chunks_to_shared(self):
for chunkid, checksum in self.chunkid_pool: