jxmlease is required if we want to display and store response in json,
however if we want output to be xml we need lxml
issue seems to be in removing name space from rpc reply , this could
be ansible issue
thanks
ex:
---
- name: xml
netconf_rpc:
rpc: get
display: xml
content: |
<filter type="subtree">
< payload >
</filter>
register: out <--- fails
On Thu, Oct 1, 2020 at 8:50 AM Dick Visser <[email protected]> wrote:
>
> The netconf_rpc module does not require lxml, but jxmlease instead.
> Make sure that is installed (as per docs
> https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/netconf_rpc_module.html#requirements).
>
> This is true for both of your python environments.
> Probably 'pip list' will show it's installed, while 'pip3 list' won't.
>
> DIck
>
> On Thu, 1 Oct 2020 at 14:38, angelo coluni <[email protected]> wrote:
> >
> > Setup:
> >
> > ansible 2.9.13
> > config file = /etc/ansible/ansible.cfg
> > configured module search path = ['/root/.ansible/plugins/modules',
> > '/usr/share/ansible/plugins/modules']
> > ansible python module location = /usr/lib/python3.6/site-packages/ansible
> > executable location = /usr/bin/ansible
> > python version = 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC 8.3.1
> > 20191121 (Red Hat 8.3.1-5)]
> >
> > installed lxml-4.5.2 ncclient-0.6.9
> >
> > Having an issue in ansible when using module netconf_rpc, the following
> > error occurs, however when I change interpreter_python = /usr/bin/python2.7
> > error is not present
> >
> > Any reason what can be causing this issue
> >
> > thanks..
> >
> >
> > <10.10.10.10> EXEC /bin/sh -c '/usr/bin/python3.6
> > /root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/AnsiballZ_netconf_rpc.py
> > && sleep 0'
> > <10.10.10.10> EXEC /bin/sh -c 'rm -f -r
> > /root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/
> > > /dev/null 2>&1 && sleep 0'
> > The full traceback is:
> > Traceback (most recent call last):
> > File
> > "/root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/AnsiballZ_netconf_rpc.py",
> > line 102, in <module>
> > _ansiballz_main()
> > File
> > "/root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/AnsiballZ_netconf_rpc.py",
> > line 94, in _ansiballz_main
> > invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
> > File
> > "/root/.ansible/tmp/ansible-local-9652MobtmE/ansible-tmp-1601554935.02-9754-119778420816035/AnsiballZ_netconf_rpc.py",
> > line 40, in invoke_module
> >
> > runpy.run_module(mod_name='ansible.modules.network.netconf.netconf_rpc',
> > init_globals=None, run_name='__main__', alter_sys=True)
> > File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
> > return _run_module_code(code, init_globals, run_name, mod_spec)
> > File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
> > mod_name, mod_spec, pkg_name, script_name)
> > File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
> > exec(code, run_globals)
> > File
> > "/tmp/ansible_netconf_rpc_payload_t8kmcb46/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py",
> > line 264, in <module>
> > File
> > "/tmp/ansible_netconf_rpc_payload_t8kmcb46/ansible_netconf_rpc_payload.zip/ansible/modules/network/netconf/netconf_rpc.py",
> > line 246, in main
> > File
> > "/tmp/ansible_netconf_rpc_payload_t8kmcb46/ansible_netconf_rpc_payload.zip/ansible/module_utils/network/common/netconf.py",
> > line 141, in remove_namespaces
> > File "/usr/local/lib/python3.6/site-packages/ncclient/xml_.py", line 174,
> > in __init__
> > self.__doc = self.remove_namespaces(self.__result)
> > File "/usr/local/lib/python3.6/site-packages/ncclient/xml_.py", line 222,
> > in remove_namespaces
> > parser=self.__parser))),
> > File "src/lxml/etree.pyx", line 3521, in lxml.etree.parse
> > File "src/lxml/parser.pxi", line 1876, in lxml.etree._parseDocument
> > File "src/lxml/parser.pxi", line 1896, in lxml.etree._parseMemoryDocument
> > File "src/lxml/parser.pxi", line 1777, in lxml.etree._parseDoc
> > File "src/lxml/parser.pxi", line 1082, in
> > lxml.etree._BaseParser._parseUnicodeDoc
> > File "src/lxml/parser.pxi", line 615, in
> > lxml.etree._ParserContext._handleParseResultDoc
> > File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
> > File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
> > File "<string>", line 1
> > lxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line 1,
> > column 1
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/ansible-project/0016a4fb-7e0e-41e1-8741-952d9d9517a9n%40googlegroups.com.
>
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwOvbm51PfEgVeRwveRCbeBgdOBLCwEY%3DZDgTrqH7jFD%2BA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CALdgpW4it0_o0n3ZEdSv3Rxab2x1mMaY76cqg3hh8p5m5szKsg%40mail.gmail.com.