From 0b4ad2749a64a11f686d0e292b3f3c2026c7bc81 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 1 Mar 2013 21:39:50 -0500 Subject: [PATCH] Increase error handling in the unlikely case of failing to establish a connection. --- AUTHORS.TXT | 2 +- lib/ansible/runner/connection_plugins/paramiko_ssh.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AUTHORS.TXT b/AUTHORS.TXT index 1f157ca95ea..fb401083da7 100644 --- a/AUTHORS.TXT +++ b/AUTHORS.TXT @@ -27,6 +27,7 @@ Chris Hoffman fdavis Jeroen Hoekx Timothy Appnel +Brian Coca Daniel Néri Dietmar Schinnerl Nikhil Singh @@ -42,7 +43,6 @@ Yeukhon Wong Yves Dorfsman lwade Anastasis Andronidis -Brian Coca Dag Wieërs Ludovic Claude Shaun Zinck diff --git a/lib/ansible/runner/connection_plugins/paramiko_ssh.py b/lib/ansible/runner/connection_plugins/paramiko_ssh.py index 938848b4421..ba36851c16d 100644 --- a/lib/ansible/runner/connection_plugins/paramiko_ssh.py +++ b/lib/ansible/runner/connection_plugins/paramiko_ssh.py @@ -156,8 +156,8 @@ class Connection(object): raise errors.AnsibleFileNotFound("file or module does not exist: %s" % in_path) try: self.sftp = self.ssh.open_sftp() - except: - raise errors.AnsibleError("failed to open a SFTP connection") + except Exception, e: + raise errors.AnsibleError("failed to open a SFTP connection (%s)" % e) try: self.sftp.put(in_path, out_path) except IOError: @@ -176,8 +176,8 @@ class Connection(object): vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host) try: self.sftp = self._connect_sftp() - except: - raise errors.AnsibleError("failed to open a SFTP connection") + except Exception, e: + raise errors.AnsibleError("failed to open a SFTP connection (%s)", e) try: self.sftp.get(in_path, out_path) except IOError: