From 292e396e4b8a56c2f167b81bc4441d35a4342419 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 7 Oct 2016 19:40:26 +0300 Subject: Add gpg command line to error message about gpg failing --- NEWS | 3 +++ obnamlib/encryption.py | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 178ee271..c1f69527 100644 --- a/NEWS +++ b/NEWS @@ -49,6 +49,9 @@ Minor changes: starts, however. Also, `/proc/mounts` must be an accurate list of mount points. +* Lars Wirzenius added the gpg command line to the error message about + gpg failing. + Bug fixes: * The manual and manual page used to claim you could break only the diff --git a/obnamlib/encryption.py b/obnamlib/encryption.py index d2c78d07..45611401 100644 --- a/obnamlib/encryption.py +++ b/obnamlib/encryption.py @@ -1,4 +1,4 @@ -# Copyright 2011-2015 Lars Wirzenius +# Copyright 2011-2016 Lars Wirzenius # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,7 +30,8 @@ class EncryptionError(obnamlib.ObnamError): class GpgError(EncryptionError): - msg = 'gpg failed with exit code {returncode}:\n{stderr}' + msg = ('gpg failed with exit code {returncode}:\n' + 'Command: {command}\n{stderr}') def generate_symmetric_key(numbits, filename='/dev/random'): @@ -129,7 +130,8 @@ def _gpg(args, stdin='', gpghome=None): # Return output data, or deal with errors. if p.returncode: # pragma: no cover - raise GpgError(returncode=p.returncode, stderr=err) + command = ' '.join(argv) + raise GpgError(command=command, returncode=p.returncode, stderr=err) return out -- cgit v1.2.1