mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 11:10:21 -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
|
@ -113,11 +113,9 @@ class Connection(ConnectionBase):
|
|||
try:
|
||||
shutil.copyfile(in_path, out_path)
|
||||
except shutil.Error:
|
||||
traceback.print_exc()
|
||||
raise AnsibleError("failed to copy: {0} and {1} are the same".format(in_path, out_path))
|
||||
except IOError:
|
||||
traceback.print_exc()
|
||||
raise AnsibleError("failed to transfer file to {0}".format(out_path))
|
||||
except IOError as e:
|
||||
raise AnsibleError("failed to transfer file to {0}: {1}".format(out_path, e))
|
||||
|
||||
def fetch_file(self, in_path, out_path):
|
||||
''' fetch a file from local to local -- for copatibility '''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue