mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Increase error handling in the unlikely case of failing to establish a connection.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user