mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
Include error exception in AnsibleError
- Use to_native instead of str Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
cce133b14f
commit
f9b836a901
5 changed files with 11 additions and 9 deletions
|
@ -43,7 +43,7 @@ from ansible.module_utils.six import iteritems
|
|||
from ansible.module_utils.six.moves import input
|
||||
from ansible.plugins.connection import ConnectionBase
|
||||
from ansible.utils.path import makedirs_safe
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.module_utils._text import to_bytes, to_native
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
|
@ -376,7 +376,7 @@ class Connection(ConnectionBase):
|
|||
try:
|
||||
self.sftp = self._connect_sftp()
|
||||
except Exception as e:
|
||||
raise AnsibleError("failed to open a SFTP connection (%s)", e)
|
||||
raise AnsibleError("failed to open a SFTP connection (%s)" % to_native(e))
|
||||
|
||||
try:
|
||||
self.sftp.get(to_bytes(in_path, errors='surrogate_or_strict'), to_bytes(out_path, errors='surrogate_or_strict'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue