mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make netconf_get python3 compat (#57578)
This uses to_text to ensure tostring() from lxml is decoded properly. Depends-On: https://github.com/ansible/ansible/pull/57309 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
a867ced4de
commit
f709d2e2bb
1 changed files with 3 additions and 2 deletions
|
@ -159,6 +159,7 @@ except ImportError:
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.netconf.netconf import get_capabilities, locked_config, get_config, get
|
||||
from ansible.module_utils.network.common.netconf import remove_namespaces
|
||||
from ansible.module_utils._text import to_text
|
||||
|
||||
try:
|
||||
import jxmlease
|
||||
|
@ -235,7 +236,7 @@ def main():
|
|||
else:
|
||||
response = get(module, filter_spec, execute_lock)
|
||||
|
||||
xml_resp = tostring(response)
|
||||
xml_resp = to_text(tostring(response))
|
||||
output = None
|
||||
|
||||
if display == 'xml':
|
||||
|
@ -246,7 +247,7 @@ def main():
|
|||
except Exception:
|
||||
raise ValueError(xml_resp)
|
||||
elif display == 'pretty':
|
||||
output = tostring(response, pretty_print=True)
|
||||
output = to_text(tostring(response, pretty_print=True))
|
||||
|
||||
result = {
|
||||
'stdout': xml_resp,
|
||||
|
|
Loading…
Reference in a new issue