2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-21 08:33:23 +00:00

Fix query to support mac or id as key

This commit is contained in:
Jarrod Johnson
2026-09-18 16:59:39 -04:00
parent fa2232ccff
commit ab5e47e6af
+3 -3
View File
@@ -662,9 +662,9 @@ async def handle_api_request(configmanager, inputdata, operation, pathcomponents
def _get_mac_from_query(pathcomponents):
_, queryparms, _, _ = _parameterize_path(pathcomponents[1:])
if 'by-mac' not in queryparms:
raise exc.InvalidArgumentException('Must target using "by-mac"')
mac = queryparms['by-mac'].replace('-', ':')
if 'by-id' not in queryparms and 'by-mac' not in queryparms:
raise exc.InvalidArgumentException('Must target using "by-mac" or "by-id"')
mac = queryparms.get('by-mac', queryparms.get('by-id', '')).replace('-', ':')
if mac not in known_info:
raise exc.NotFoundException('{0} not found'.format(mac))
return mac