2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Fix traceback when multiple criteria have no matches

When a parent criteria has no match, then the api
returns a 404 as there is no parent.  Handle this
by only listing positively matched items.
This commit is contained in:
Jarrod Johnson 2021-02-24 16:39:01 -05:00
parent 4c6f41ffb2
commit 481a70c304

View File

@ -263,7 +263,11 @@ def list_matching_macs(options, session, node=None, checknode=True):
return [options.mac.replace(':', '-')]
else:
path += 'by-mac/'
return [x['item']['href'] for x in session.read(path)]
ret = []
for x in session.read(path):
if 'item' in x and 'href' in x['item']:
ret.append(x['item', 'href'])
return ret
def assign_discovery(options, session, needid=True):
abort = False