Increase error handling in the unlikely case of failing to establish a connection.

This commit is contained in:
Michael DeHaan 2013-03-01 21:39:50 -05:00
parent 4132f8953e
commit 0b4ad2749a
2 changed files with 5 additions and 5 deletions

View file

@ -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: