2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-03-19 09:57:45 +00:00

Provide a cleaner error on peer not found

Auto-refresh and provide cleaner error on ultimately missing data.
This commit is contained in:
Jarrod Johnson 2017-10-03 11:52:28 -04:00
parent 60b7083dce
commit 697716b296

View File

@ -291,6 +291,11 @@ def _handle_neighbor_query(pathcomponents, configmanager):
pathcomponents)
if not childcoll: # this means it's a single entry with by-peerid
# guaranteed
if (parms['by-peerid'] not in _neighbypeerid and
_neighbypeerid.get('!!vintage', 0) < util.monotonic_time() - 60):
list(update_neighbors(configmanager))
if parms['by-peerid'] not in _neighbypeerid:
raise exc.NotFoundException('No matching peer known')
return _dump_neighbordatum(_neighbypeerid[parms['by-peerid']])
if not listrequested: # the query is for currently valid choices
return [msg.ChildCollection(x + '/') for x in sorted(list(choices))]