mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
Fix junos_command py3 related issues (#36782)
Fixes #36204 * tostring() input string shoulb be in byte string format * to_ele() input is required in unicode format
This commit is contained in:
parent
2fbfce06e7
commit
41d75783b5
4 changed files with 7 additions and 6 deletions
|
@ -27,7 +27,7 @@
|
|||
#
|
||||
import sys
|
||||
|
||||
from ansible.module_utils._text import to_text, to_native
|
||||
from ansible.module_utils._text import to_text, to_bytes
|
||||
from ansible.module_utils.connection import Connection, ConnectionError
|
||||
|
||||
try:
|
||||
|
@ -67,9 +67,9 @@ class NetconfConnection(Connection):
|
|||
response = self._exec_jsonrpc(name, *args, **kwargs)
|
||||
if 'error' in response:
|
||||
rpc_error = response['error'].get('data')
|
||||
return self.parse_rpc_error(to_native(rpc_error, errors='surrogate_then_replace'))
|
||||
return self.parse_rpc_error(to_bytes(rpc_error, errors='surrogate_then_replace'))
|
||||
|
||||
return fromstring(to_native(response['result'], errors='surrogate_then_replace'))
|
||||
return fromstring(to_bytes(response['result'], errors='surrogate_then_replace'))
|
||||
|
||||
def parse_rpc_error(self, rpc_error):
|
||||
if self.check_rc:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue