mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
yanger: Handle the case when a container interface can not be found
Due to #902 (which has not been root caused at this time), podman may indicate the existance of an interface that yanger is not able to locate in any namespace. Therefore, make sure that we verify that the interface was actually found before trying to create the operational data for it.
This commit is contained in:
@@ -16,6 +16,8 @@ def find_interface(cifname):
|
||||
ipaddrs = common.ipaddrs(ifname=iplink["ifname"], netns=ns["name"])
|
||||
return (iplink, next(iter(ipaddrs.values())))
|
||||
|
||||
return (None, None)
|
||||
|
||||
|
||||
def podman_interfaces():
|
||||
interfaces = {}
|
||||
@@ -31,6 +33,7 @@ def podman_interfaces():
|
||||
|
||||
return interfaces
|
||||
|
||||
|
||||
def interfaces(ifname):
|
||||
interfaces = []
|
||||
|
||||
@@ -39,6 +42,9 @@ def interfaces(ifname):
|
||||
continue
|
||||
|
||||
iplink, ipaddr = find_interface(cifname)
|
||||
if not (iplink and ipaddr):
|
||||
continue
|
||||
|
||||
interface = link.interface_common(iplink, ipaddr)
|
||||
|
||||
# The original interface name is stored in ifalias by podman -
|
||||
|
||||
Reference in New Issue
Block a user