Increase error handling in the unlikely case of failing to establish a connection.
parent
4132f8953e
commit
0b4ad2749a
|
@ -27,6 +27,7 @@ Chris Hoffman <christopher.hoffman@gmail.com>
|
||||||
fdavis <reddot357@hotmail.com>
|
fdavis <reddot357@hotmail.com>
|
||||||
Jeroen Hoekx <jeroen@hoekx.be>
|
Jeroen Hoekx <jeroen@hoekx.be>
|
||||||
Timothy Appnel <tim@appnel.com>
|
Timothy Appnel <tim@appnel.com>
|
||||||
|
Brian Coca <briancoca+dev@gmail.com>
|
||||||
Daniel Néri <dne@mayonnaise.net>
|
Daniel Néri <dne@mayonnaise.net>
|
||||||
Dietmar Schinnerl <SleeplessAnnoyedNerd+github@gmail.com>
|
Dietmar Schinnerl <SleeplessAnnoyedNerd+github@gmail.com>
|
||||||
Nikhil Singh <nix85@ymail.com>
|
Nikhil Singh <nix85@ymail.com>
|
||||||
|
@ -42,7 +43,6 @@ Yeukhon Wong <yeukhon@acm.org>
|
||||||
Yves Dorfsman <yves@zioup.com>
|
Yves Dorfsman <yves@zioup.com>
|
||||||
lwade <lestertron@gmail.com>
|
lwade <lestertron@gmail.com>
|
||||||
Anastasis Andronidis <anastasis90@yahoo.gr>
|
Anastasis Andronidis <anastasis90@yahoo.gr>
|
||||||
Brian Coca <briancoca+dev@gmail.com>
|
|
||||||
Dag Wieërs <dag@wieers.com>
|
Dag Wieërs <dag@wieers.com>
|
||||||
Ludovic Claude <ludovic.claude@lbpoker.com>
|
Ludovic Claude <ludovic.claude@lbpoker.com>
|
||||||
Shaun Zinck <shaun.zinck@gmail.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)
|
raise errors.AnsibleFileNotFound("file or module does not exist: %s" % in_path)
|
||||||
try:
|
try:
|
||||||
self.sftp = self.ssh.open_sftp()
|
self.sftp = self.ssh.open_sftp()
|
||||||
except:
|
except Exception, e:
|
||||||
raise errors.AnsibleError("failed to open a SFTP connection")
|
raise errors.AnsibleError("failed to open a SFTP connection (%s)" % e)
|
||||||
try:
|
try:
|
||||||
self.sftp.put(in_path, out_path)
|
self.sftp.put(in_path, out_path)
|
||||||
except IOError:
|
except IOError:
|
||||||
|
@ -176,8 +176,8 @@ class Connection(object):
|
||||||
vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host)
|
vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host)
|
||||||
try:
|
try:
|
||||||
self.sftp = self._connect_sftp()
|
self.sftp = self._connect_sftp()
|
||||||
except:
|
except Exception, e:
|
||||||
raise errors.AnsibleError("failed to open a SFTP connection")
|
raise errors.AnsibleError("failed to open a SFTP connection (%s)", e)
|
||||||
try:
|
try:
|
||||||
self.sftp.get(in_path, out_path)
|
self.sftp.get(in_path, out_path)
|
||||||
except IOError:
|
except IOError:
|
||||||
|
|
Loading…
Reference in New Issue