-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
juniper_junos_command - lxml.etree.XMLSyntaxError: StartTag: invalid element name #528
Comments
Hi @fredtj -
Sample Output :
Refer - https://junos-ansible-modules.readthedocs.io/en/2.4.0/juniper_junos_config.html for similar examples. Let us know if this works for you. |
hello, thanks, i did test using that method, but it is not comparing the configs as i would like - it is comparing the configs the wrong way round (ie the + and - etc are reversed) |
@rahkumar651991 i've tracked this problem down, the error occurs when the diff/compare contains an & or < or > any chance you could take a look please? |
the problem line is in library/juniper_junos_command.py
|
the traceback is very similar to: https://stackoverflow.com/questions/37005830/how-to-read-an-xml-file-with-sign/37006646 is there any workaround you are aware of? |
finally managed to fix this by editing _xml.py in ncclient package and adding recover=True to the XMLParser construct:
not sure why it is a problem as when i run "show system rollback 0 compare 1 | display xml" on the device, the ampersand character is returned as @rahkumar651991 let me know if i should report this elsewhere |
@fredtj - thanks for the analysis. Could you help me with the exact output you are seeing for the error.
I am not able to replicate the scenario in my local setup. I will try to hardocode the values and try to execute it. |
first, create a commit containing an & character:
without the & sign in the commit, ansible runs the command "show system rollback 0 compare 1" OK. With the & sign, here is the error:
|
this is also happening with < and > in the commit, so failures occur for things like the following:
|
As a workaround, you can use the below way. Let me follow up with ncclient bug
|
Please note that to be valid in an XML document, this text:
...would ideally be encoded as:
If it is not encoded thus, the I have commented similarly on an issue raised by @dineshbaburam91 on the If you can provide more details on the actual XML payload that is triggering the error in parsing with the error stack shown in #528 (comment), that would be helpful. |
this is still is still an issue for us and I'm wondering if we can pick it up again? |
Issue Type
Module Name: juniper_junos_command
OS / Environment
SRX110-H2-VA
12.3X48-D105.4
Summary
Using following playbook, an error occurs
Expected results
output of command saved to file
Actual results
on the device cli the command returns the expected output. out of hundreds of devices, 3 are giving this failure at the moment.
The text was updated successfully, but these errors were encountered: