Correct the returnvalue of get_parent_by_name() if ifname==None, add tests for that

This commit is contained in:
Pim van Pelt
2022-04-10 15:48:34 +00:00
parent 72668bdb18
commit 5fc3b4c42b
2 changed files with 4 additions and 2 deletions

View File

@ -52,8 +52,6 @@ def get_qinx_parent_by_name(yaml, ifname):
def get_parent_by_name(yaml, ifname):
""" Returns the sub-interface's parent, or None,None if the sub-int doesn't exist. """
if not '.' in ifname:
return None, None
try:
parent_ifname, subid = ifname.split('.')
subid = int(subid)