Skip to content

Commit

Permalink
yanger: Handle the case when a container interface can not be found
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wkz committed Jan 22, 2025
1 parent a640460 commit c2959cf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/statd/python/yanger/ietf_interfaces/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -31,6 +33,7 @@ def podman_interfaces():

return interfaces


def interfaces(ifname):
interfaces = []

Expand All @@ -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 -
Expand Down

0 comments on commit c2959cf

Please sign in to comment.