mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -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
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue