From 73687bfc8afe7d60a2c4e2efd9af851514703dff Mon Sep 17 00:00:00 2001
From: Robert Latta <robert.latta@geant.org>
Date: Wed, 10 Feb 2021 11:56:27 +0000
Subject: [PATCH] schema compliance

---
 inventory_provider/routes/ims_classifier.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/inventory_provider/routes/ims_classifier.py b/inventory_provider/routes/ims_classifier.py
index 29b3b2e1..c55a784a 100644
--- a/inventory_provider/routes/ims_classifier.py
+++ b/inventory_provider/routes/ims_classifier.py
@@ -279,10 +279,13 @@ def get_interface_services_and_locs(ims_source_equipment, ims_interface, r):
                 r.pop('id', None)
 
     if not result.get('locations'):
-        result['locations'] = [
-            build_locations(
-                _location_from_equipment(ims_source_equipment, r))
-        ]
+        locations = build_locations(
+            _location_from_equipment(ims_source_equipment, r))
+        result['locations'] = [locations] if locations else []
+    if not result['services']:
+        result.pop('services', None)
+    if not result['related-services']:
+        result.pop('related-services', None)
 
     result['locations'] = _remove_duplicates_from_list(result['locations'])
     return result
-- 
GitLab