mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Netconf bytes fixes (#41607)
* Solve some bytes issues on iosxr * Solve some bytes issues in junos * Do the correct thing with tostring based on lxml or not
This commit is contained in:
@@ -165,15 +165,15 @@ import shlex
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.network.common.netconf import exec_rpc
|
||||
from ansible.module_utils.network.junos.junos import junos_argument_spec, get_configuration, get_connection, get_capabilities
|
||||
from ansible.module_utils.network.junos.junos import junos_argument_spec, get_configuration, get_connection, get_capabilities, tostring
|
||||
from ansible.module_utils.network.common.parsing import Conditional, FailedConditionalError
|
||||
from ansible.module_utils.six import string_types, iteritems
|
||||
|
||||
|
||||
try:
|
||||
from lxml.etree import Element, SubElement, tostring
|
||||
from lxml.etree import Element, SubElement
|
||||
except ImportError:
|
||||
from xml.etree.ElementTree import Element, SubElement, tostring
|
||||
from xml.etree.ElementTree import Element, SubElement
|
||||
|
||||
try:
|
||||
import jxmlease
|
||||
@@ -233,7 +233,7 @@ def rpc(module, items):
|
||||
if fetch_config:
|
||||
reply = get_configuration(module, format=xattrs['format'])
|
||||
else:
|
||||
reply = exec_rpc(module, to_text(tostring(element), errors='surrogate_then_replace'), ignore_warning=False)
|
||||
reply = exec_rpc(module, tostring(element), ignore_warning=False)
|
||||
|
||||
if xattrs['format'] == 'text':
|
||||
if fetch_config:
|
||||
|
||||
Reference in New Issue
Block a user