diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-08-15 18:33:48 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-08-15 18:33:48 +0100 |
commit | 591d01ba585ef1de989ba0b1aa66383ad5e3202f (patch) | |
tree | f8360b4382904181f4121d432807d8f024d5a78a | |
parent | a10967e1b810b19096268433ce908cfd83972ee8 (diff) | |
download | obnam-591d01ba585ef1de989ba0b1aa66383ad5e3202f.tar.gz |
Fix list-toplevels so it doesn't mind other clients
Fix by Lars Kruse.
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | obnamlib/__init__.py | 4 | ||||
-rw-r--r-- | obnamlib/encryption.py | 4 | ||||
-rw-r--r-- | obnamlib/plugins/encryption_plugin.py | 7 |
4 files changed, 18 insertions, 3 deletions
@@ -9,6 +9,12 @@ Version 1.6, released UNRELEASED * Stop logging paramiko exceptions that get converted into another type of exception by the SFTP plugin in Obnam. +Bug fixes: + +* Fix "obnam list-toplevels" so it doesn't give an error when it's + unable to read the per-client directory of another client, when + encryption is used. Fix by Lars Kruse. + Version 1.5, released 2013-08-08 -------------------------------- diff --git a/obnamlib/__init__.py b/obnamlib/__init__.py index e4900870..8caa77da 100644 --- a/obnamlib/__init__.py +++ b/obnamlib/__init__.py @@ -40,6 +40,10 @@ class Error(cliapp.AppException): pass +class EncryptionError(Error): + pass + + DEFAULT_NODE_SIZE = 256 * 1024 # benchmarked on 2011-09-01 DEFAULT_CHUNK_SIZE = 1024 * 1024 # benchmarked on 2011-09-01 DEFAULT_UPLOAD_QUEUE_SIZE = 128 diff --git a/obnamlib/encryption.py b/obnamlib/encryption.py index d4a75f8d..3381c61f 100644 --- a/obnamlib/encryption.py +++ b/obnamlib/encryption.py @@ -93,7 +93,7 @@ def _gpg_pipe(args, data, passphrase): # Return output data, or deal with errors. if p.returncode: # pragma: no cover - raise obnamlib.Error(err) + raise obnamlib.EncryptionError(err) return out @@ -125,7 +125,7 @@ def _gpg(args, stdin='', gpghome=None): # Return output data, or deal with errors. if p.returncode: # pragma: no cover - raise obnamlib.Error(err) + raise obnamlib.EncryptionError(err) return out diff --git a/obnamlib/plugins/encryption_plugin.py b/obnamlib/plugins/encryption_plugin.py index 891e76d5..d8173346 100644 --- a/obnamlib/plugins/encryption_plugin.py +++ b/obnamlib/plugins/encryption_plugin.py @@ -196,7 +196,12 @@ class EncryptionPlugin(obnamlib.ObnamPlugin): keys = dict() tops = dict() for toplevel in [d for d in toplevels if d != 'metadata']: - userkeys = self.read_keyring(repo, toplevel) + try: + userkeys = self.read_keyring(repo, toplevel) + except obnamlib.EncryptionError: + # other client's toplevels are unreadable + tops[toplevel] = [] + continue for keyid in userkeys.keyids(): keys[keyid] = keys.get(keyid, []) + [toplevel] tops[toplevel] = tops.get(toplevel, []) + [keyid] |