mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00: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:
@@ -102,7 +102,7 @@ class NetconfBase(with_metaclass(ABCMeta, object)):
|
||||
"""RPC to be execute on remote device
|
||||
:name: Name of rpc in string format"""
|
||||
try:
|
||||
obj = to_ele(to_bytes(name, errors='surrogate_or_strict'))
|
||||
obj = to_ele(name)
|
||||
resp = self.m.rpc(obj)
|
||||
return resp.data_xml if hasattr(resp, 'data_xml') else resp.xml
|
||||
except RPCError as exc:
|
||||
|
||||
@@ -50,7 +50,7 @@ class Netconf(NetconfBase):
|
||||
device_info['network_os'] = 'junos'
|
||||
ele = new_ele('get-software-information')
|
||||
data = self.execute_rpc(to_xml(ele))
|
||||
reply = to_ele(to_bytes(data, errors='surrogate_or_strict'))
|
||||
reply = to_ele(data)
|
||||
sw_info = reply.find('.//software-information')
|
||||
|
||||
device_info['network_os_version'] = self.get_text(sw_info, 'junos-version')
|
||||
|
||||
Reference in New Issue
Block a user