mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Fixing up error handling for fetch_file ops in connection plugins
* enable batch mode (configurable with a config option, on by default) for sftp transfers, so we can catch errors more easily * general cleanup in the local connection plugin and fetch action plugin Fixes #11612
This commit is contained in:
parent
993ce592b1
commit
7a9916422a
5 changed files with 20 additions and 7 deletions
|
@ -131,9 +131,12 @@ class ActionModule(ActionBase):
|
|||
if remote_data is None:
|
||||
self._connection.fetch_file(source, dest)
|
||||
else:
|
||||
f = open(dest, 'w')
|
||||
f.write(remote_data)
|
||||
f.close()
|
||||
try:
|
||||
f = open(dest, 'w')
|
||||
f.write(remote_data)
|
||||
f.close()
|
||||
except (IOError, OSError) as e:
|
||||
raise AnsibleError("Failed to fetch the file: %s" % e)
|
||||
new_checksum = secure_hash(dest)
|
||||
# For backwards compatibility. We'll return None on FIPS enabled
|
||||
# systems
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue