From 707e11fda5d494243b3bd748bbc3047733190cc6 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Mon, 2 Aug 2021 18:55:13 +0200 Subject: [PATCH] added dashboards to interface rsp schema --- inventory_provider/routes/poller.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/inventory_provider/routes/poller.py b/inventory_provider/routes/poller.py index 70a69946..70e1ac9c 100644 --- a/inventory_provider/routes/poller.py +++ b/inventory_provider/routes/poller.py @@ -131,12 +131,16 @@ INTERFACE_LIST_SCHEMA = { 'circuits': { 'type': 'array', 'items': {'$ref': '#/definitions/service'} + }, + 'dashboards': { + 'type': 'array', + 'items': {'enum': [d.name for d in list(BRIAN_DASHBOARDS)]} } }, 'required': [ 'router', 'name', 'description', 'snmp-index', 'bundle', 'bundle-parents', - 'circuits'], + 'circuits', 'dashboards'], 'additionalProperties': False }, }, @@ -382,7 +386,12 @@ def _add_dashboards(interfaces): """ for ifc in interfaces: - ifc['dashboards'] = sorted(list(_get_dashboards(ifc))) + try: + dashboards = _get_dashboards(ifc) + ifc['dashboards'] = sorted(list(d.name for d in dashboards)) + except: + logger.exception('???') + raise yield ifc -- GitLab