From 697716b296e27f79ca5290c30906010e34d21a8c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 3 Oct 2017 11:52:28 -0400 Subject: [PATCH] Provide a cleaner error on peer not found Auto-refresh and provide cleaner error on ultimately missing data. --- confluent_server/confluent/networking/lldp.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/confluent_server/confluent/networking/lldp.py b/confluent_server/confluent/networking/lldp.py index 710c4fe6..803c405c 100644 --- a/confluent_server/confluent/networking/lldp.py +++ b/confluent_server/confluent/networking/lldp.py @@ -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))]