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

pull/2272/head
Michael DeHaan 12 years ago
parent 4132f8953e
commit 0b4ad2749a

@ -27,6 +27,7 @@ Chris Hoffman <christopher.hoffman@gmail.com>
fdavis <reddot357@hotmail.com>
Jeroen Hoekx <jeroen@hoekx.be>
Timothy Appnel <tim@appnel.com>
Brian Coca <briancoca+dev@gmail.com>
Daniel Néri <dne@mayonnaise.net>
Dietmar Schinnerl <SleeplessAnnoyedNerd+github@gmail.com>
Nikhil Singh <nix85@ymail.com>
@ -42,7 +43,6 @@ Yeukhon Wong <yeukhon@acm.org>
Yves Dorfsman <yves@zioup.com>
lwade <lestertron@gmail.com>
Anastasis Andronidis <anastasis90@yahoo.gr>
Brian Coca <briancoca+dev@gmail.com>
Dag Wieërs <dag@wieers.com>
Ludovic Claude <ludovic.claude@lbpoker.com>
Shaun Zinck <shaun.zinck@gmail.com>

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

Loading…
Cancel
Save