mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-14 04:09:11 -07:00
Increase error handling in the unlikely case of failing to establish a connection.
This commit is contained in:
parent
4132f8953e
commit
0b4ad2749a
2 changed files with 5 additions and 5 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue