Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ipintutil]Handle exception in show ip interfaces command (sonic-net#…
…3182) ### What I did Handle exception in show ip interfaces command when executed during config reload. Sometimes during config reload the interfaces are removed and if show ip interfaces was executed during this time we may get the below traceback. The interface would exist when the call multi_asic_get_ip_intf_from_ns was made but would have been removed in the subsequent for loop which tries to get ip interface data for each interface ``` show ip interfaces Traceback (most recent call last): File "/usr/local/bin/ipintutil", line 276, in main() File "/usr/local/bin/ipintutil", line 269, in main ip_intfs = get_ip_intfs(af, namespace, display) File "/usr/local/bin/ipintutil", line 232, in get_ip_intfs ip_intfs_in_ns = get_ip_intfs_in_namespace(af, namespace, display) File "/usr/local/bin/ipintutil", line 153, in get_ip_intfs_in_namespace ipaddresses = multi_asic_util.multi_asic_get_ip_intf_addr_from_ns(namespace, iface) File "/usr/local/lib/python3.9/dist-packages/utilities_common/multi_asic.py", line 186, in multi_asic_get_ip_intf_addr_from_ns ipaddresses = netifaces.ifaddresses(iface) ValueError: You must specify a valid interface name. ``` #### How I did it Adding try exception block so that if an interface is not present, it would be skipped. #### How to verify it Running show ip interface command and performing config reload in parallel
- Loading branch information