summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--obnamlib/app.py10
2 files changed, 14 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 4eeeda63..cfd4be0c 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,10 @@ Version 1.21+git, not yet released
* SanskritFritz and Ian Cambell fixed the kdirstat plugin.
+* Lars Wirzenius changed Obnam to hide a Python stack trace when
+ there's a problem with the SSH connection (e.g., failure to
+ authenticate, or existing connection breaks).
+
Version 1.21, released 2016-12-29
------------------------------------
diff --git a/obnamlib/app.py b/obnamlib/app.py
index ce32f242..e5d76010 100644
--- a/obnamlib/app.py
+++ b/obnamlib/app.py
@@ -22,6 +22,7 @@ import tracing
import cliapp
import larch
+import paramiko
import ttystatus
import obnamlib
@@ -32,6 +33,11 @@ class ObnamIOError(obnamlib.ObnamError):
msg = 'I/O error: {filename}: {errno}: {strerror}'
+class ObnamSSHError(obnamlib.ObnamError):
+
+ msg = 'SSH error: {msg}'
+
+
class ObnamSystemError(obnamlib.ObnamError):
msg = 'System error: {filename}: {errno}: {strerror}'
@@ -221,6 +227,10 @@ class App(cliapp.Application):
self.hooks.call('config-loaded')
cliapp.Application.process_args(self, args)
self.hooks.call('shutdown')
+ except paramiko.SSHException as e:
+ logging.critical(
+ 'Caught SSHExcpetion: %s', str(e), exc_info=True)
+ raise ObnamSSHError(msg=str(e))
except IOError as e:
logging.critical('Caught IOError: %s', str(e), exc_info=True)
raise ObnamIOError(