-
Notifications
You must be signed in to change notification settings - Fork 109
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
Multiple parsing issues when running the nxos_facts module #811
Comments
@cpund I wonder if you are hitting a problem with get_facts that I am with NXOS devices that do not support the "| json-pretty" cli option. I found this comment in a closed issue regarding timeouts associated with get_facts where the fix involved using "| json-pretty" and falling back to "| json" if the device does not support json-pretty The problem is I don't think the fall back option is working. Before 6.0.0 I was seeing fact data, after the update I only see empty lists in the output without any Ansible failures similar to your explanation. Interestingly what tipped me off to this issue was the results we see for ansible_net_fan_info as shown below. Which looks like you have as well. {
"ansible_facts": {
"ansible_net_all_ipv4_addresses": [],
"ansible_net_all_ipv6_addresses": [],
"ansible_net_api": "cliconf",
"ansible_net_fan_info": [
{
"hw_ver": "|",
"model": "environment",
"name": "show",
"status": "json-pretty"
},
{
"hw_ver": "'^'",
"model": "Invalid",
"name": "%",
"status": "marker."
}
],
}
} |
I can definitely confirm that the issue is with detection of whether or not output is in json or pretty_json. I just commented out the following lines: cisco.nxos/plugins/module_utils/network/nxos/facts/legacy/base.py Lines 41 to 44 in 472ae1b
and the facts module ran flawlessly. I've got neighbor information, fan info, interface info, and more! So now to determine why/how it's parsing this incorrectly - still a little rough around the edge debugging ansible modules though. Guessing by the following lines, an Exception is not being raised and thus it never re-attempts with plain old "| json". Edit: Further research, it seems like on my version/model combo of NX-OS, |
SUMMARY
When running a simple playbook to extract all of the facts, using cisco.nxos.nxos_facts module (with particular interest in the neighbors), the module silently fails to gather any neighbors, as well as additional weird parsing of some details.
ISSUE TYPE
COMPONENT NAME
nxos_facts
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
WSL: 5.15.133.1-microsoft-standard-WSL2
Linux flavor: Ubuntu 22.04.3 LTS
Nexus Supervisor: N77-SUP3E
NX-OS Version: 8.3(2)
STEPS TO REPRODUCE
EXPECTED RESULTS
I expect for data to be properly extracted and parsed, but have noticed multiple issues with the parsing, particular under the ansible_net_neighbors, ansible_net_fan_info, and ansible_net_interfaces sections.
ACTUAL RESULTS
It appears as if the parser is experiencing difficulty in multiple circumstances, as the output indicates that instead of saving the output of the command, it instead saves the command itself. It then tries to parse the saved command (as opposed to the output of it). The Ansible playbook indicates no errors and successfully saves the output to a file as requested later in the playbook. Upon further request, I can work to strip out sensitive information from the -vvvv and post it later.
The text was updated successfully, but these errors were encountered: