summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-13 19:04:04 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-13 19:04:04 +0000
commitacddf011115d7537bd4d7cae91977c0c897ac047 (patch)
tree8d4a958b7476af1c68e1da4a875fa0673d022196
parent24ab8f5d695a160b8e84f126c3595f71820e5abe (diff)
downloadobnam-acddf011115d7537bd4d7cae91977c0c897ac047.tar.gz
Improve error message when secret key missing
The actual gpg error message is now shown, instead of hidden behind a "unknown tag found" message.
-rw-r--r--obnamlib/plugins/encryption_plugin.py2
-rw-r--r--yarns/0060-encryption.yarn3
-rw-r--r--yarns/obnam.sh5
3 files changed, 7 insertions, 3 deletions
diff --git a/obnamlib/plugins/encryption_plugin.py b/obnamlib/plugins/encryption_plugin.py
index 29e32efe..3c20de25 100644
--- a/obnamlib/plugins/encryption_plugin.py
+++ b/obnamlib/plugins/encryption_plugin.py
@@ -122,8 +122,6 @@ class EncryptionPlugin(obnamlib.ObnamPlugin):
self._write_file(repo, os.path.join(toplevel, 'userkeys'), encrypted)
def filter_read(self, encrypted, repo, toplevel):
- if not self.keyid:
- return encrypted
symmetric_key = self.get_symmetric_key(repo, toplevel)
return obnamlib.decrypt_symmetric(encrypted, symmetric_key)
diff --git a/yarns/0060-encryption.yarn b/yarns/0060-encryption.yarn
index 384d7a70..b30234be 100644
--- a/yarns/0060-encryption.yarn
+++ b/yarns/0060-encryption.yarn
@@ -99,7 +99,8 @@ client, should not be able to access the data.
GIVEN a user U3 calling themselves U1
WHEN user U3 attempts to restore their latest generation in repository R into X3
THEN the attempt failed with exit code 1
- AND the error message matches "R169C6X: Unknown filter tag\|R173AEX: No filter tag found"
+ AND the error message matches "R0C79EX: gpg failed"
+ AND the error message matches "secret key not available"
(The error message above indicates that there's a bug in Obnam, which
is that the error message, when an encryption is not provided but the
diff --git a/yarns/obnam.sh b/yarns/obnam.sh
index 6062ef9a..50080d2b 100644
--- a/yarns/obnam.sh
+++ b/yarns/obnam.sh
@@ -156,3 +156,8 @@ manifest()
normalise_manifest_times |
remove_nlink_for_directories
}
+
+
+# Create a dummy $HOME that actually exists.
+export HOME="$DATADIR/home"
+mkdir -p "$HOME"