Closed stephengzh closed 4 years ago
KeyError: 'ansible_facts'
means that calling lldp_facts
ansible module on localhost
somehow failed and didn't return results.
You can add pytest argument --log-cli-level debug
to output more detailed logs to console. If you need detailed log file, please add argument --log-file-level debug --log-file test_lldp.log
.
The log should contain detailed information of calling ansible modules and their returned results. For example: https://sonic-jenkins.westus2.cloudapp.azure.com/job/common/job/sonic-mgmt-testing/job/sonic-mgmt-pr/795/artifact/sonic-mgmt/tests/logs/1vlan/lldp/test_lldp.log
07/08/2020 08:09:47 DEBUG devices.py:_run:55: /data/sonic-mgmt/tests/lldp/test_lldp.py::test_lldp_neighbor#62: [localhost] AnsibleModule::lldp_facts, args=[], kwargs={"host": "10.250.0.52", "version": "v2c", "community": "strcommunity"}
07/08/2020 08:09:48 DEBUG devices.py:_run:69: /data/sonic-mgmt/tests/lldp/test_lldp.py::test_lldp_neighbor#62: [localhost] AnsibleModule::lldp_facts Result => {"invocation": {"module_args": {"username": null, "privacy": null, "level": null, "community": "strcommunity", "authkey": null, "host": "10.250.0.52", "version": "v2c", "integrity": null, "removeplaceholder": null, "privkey": null}}, "changed": false, "_ansible_no_log": false, "ansible_facts": {"ansible_lldp_facts": {"Ethernet1": {"neighbor_port_id": "fortyGigE0/116", "neighbor_port_desc": "ARISTA02T1:Ethernet1", "neighbor_sys_desc": "Debian GNU/Linux 10 (buster) Linux 4.19.0-9-2-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64", "neighbor_chassis_id": "0x525400f9b224", "neighbor_sys_name": "vlab-01"}}}}
Actually, anyone knows the location about "localhost"? It only shows the KeyError: 'ansible facts', but it should better print the error exact position. For me, if not very very familiar with the pytest structure, I will feel difficult to locate the source of each parameter...