Open xibriz opened 1 year ago
@xibriz Thank you for reporting this. Do you mean that your target device does not support any form of | json
output?
Also, please note that the chassis and NX-OS combination you shared is not a part of our platform support matrix and hence, fixing this issue will be on a best effort basis.
Thank you.
@NilashishC Yes, that is correct, see the output below.
You know the collection best, but I (and probably others) would be happy with a more robust solution of my fix, or some kind of option in the facts module to force text output in stead of json.
Since the rest of the code handles text output as well as json, this should be possible without breaking anything?
HOSTNAME# show interface | ?
cut Print selected parts of lines.
diff Show difference between current and previous invocation (creates temp files: remove them with 'diff-clean' command and dont use it on commands with big
outputs, like 'show tech'!)
egrep Egrep - print lines matching a pattern
grep Grep - print lines matching a pattern
head Display first lines
human Output in human format
last Display last lines
less Filter for paging
no-more Turn-off pagination for command output
section Show lines that include the pattern as well as the subsequent lines that are more indented than matching line
sort Stream Sorter
source Run a script (python, tcl,...) from bootflash:scripts
tr Translate, squeeze, and/or delete characters
uniq Discard all but one of successive identical lines
vsh The shell that understands cli command
wc Count words, lines, characters
xml Output in xml format (according to .xsd definitions)
begin Begin with the line that matches
count Count number of lines
end End with the line that matches
exclude Exclude lines that match
include Include lines that match
Considering the substantial effort involved and the fact that NX-OS versions lacking support for | json fall outside our current support scope, we've made the decision not to pursue this implementation. However, we strongly encourage contributions from the community! If anyone is enthusiastic about tackling this challenge, we'd be delighted to accept and review their contributions. As such, I've added the waiting_on_contributor
label to this. Should a pull request be submitted, we'll review and collaborate on moving it forward together.
Thank you!
I have a Nexus 5596 with NXOS 7.0(2)N1(1)
When trying to gather facts
ansible_net_interfaces
does not get populated correctly.Further investigating shows that the command
show interface | json-pretty
is not supported. The device does not have any json capabilities.It seems like some sort of text fallback is missing in the run-function.
https://github.com/ansible-collections/cisco.nxos/blob/005a400ad3c89af46b7f4ca105ff15a1da0277e7/plugins/module_utils/network/nxos/facts/legacy/base.py#L39-L65
I have temporarly solved the problem by adding the following code: