diff --git a/inventory_provider/routes/opsdb.py b/inventory_provider/routes/opsdb.py index ec091fae82bc853aba56659c8ea35520e3f60ea5..8543c25dc17c30c0522a0d7f76e63ac43b252c89 100644 --- a/inventory_provider/routes/opsdb.py +++ b/inventory_provider/routes/opsdb.py @@ -49,7 +49,7 @@ def get_interface_details(equipment_name, interface): r = common.get_redis() key = 'opsdb:interface_services:%s:%s' % (equipment_name, interface) # TODO: handle None (return 404) - return jsonify(r.get(key).decode('utf-8')) + return jsonify(json.loads(r.get(key).decode('utf-8'))) @routes.route("/equipment-location") @@ -67,20 +67,22 @@ def get_all_equipment_locations(): @routes.route("/equipment-location/<path:equipment_name>") def get_equipment_location(equipment_name): r = common.get_redis() - return jsonify(r.get('opsdb:location:' + equipment_name)) + result = r.get('opsdb:location:' + equipment_name) + # TODO: handle None (return 404) + return jsonify(json.loads(result.decode('utf-8'))) @routes.route("/circuit-hierarchy/children/<int:parent_id>") def get_children(parent_id): r = common.get_redis() - return Response( - r.get('opsdb:services:children:%d' % parent_id), - mimetype="application/json") + result = r.get('opsdb:services:children:%d' % parent_id) + # TODO: handle None (return 404) + return jsonify(json.loads(result.decode('utf-8'))) @routes.route("/circuit-hierarchy/parents/<int:child_id>") def get_parents(child_id): r = common.get_redis() - return Response( - r.get('opsdb:services:parents:%d' % child_id), - mimetype="application/json") + result = r.get('opsdb:services:parents:%d' % child_id) + # TODO: handle None (return 404) + return jsonify(json.loads(result.decode('utf-8')))