diff --git a/inventory_provider/routes/testing.py b/inventory_provider/routes/testing.py index d63cb3c2a1137640bf4e24959a7d38241d20801f..ec782eb99c17b9d6b62d22b64cf3a2c1409dc9d1 100644 --- a/inventory_provider/routes/testing.py +++ b/inventory_provider/routes/testing.py @@ -1,5 +1,7 @@ import json +import logging import os +from distutils.util import strtobool from operator import itemgetter from flask import Blueprint, Response, jsonify, current_app, request @@ -13,6 +15,7 @@ from inventory_provider.tasks import common as worker_common routes = Blueprint("inventory-data-testing-support-routes", __name__) +logger = logging.getLogger(__name__) @routes.route("flushdb", methods=['GET', 'POST']) def flushdb(): @@ -115,8 +118,10 @@ def latch_db(): @routes.route("/circuit-tree/<path:root_identifier>", methods=['GET', 'POST']) def circuit_tree(root_identifier: str): - carriers = request.args.get('carriers', default='false', type=str) - interface_ = request.args.get('interface', default='false', type=str) + carriers = \ + strtobool(request.args.get('carriers', default='false', type=str)) + interface_ = \ + strtobool(request.args.get('interface', default='false', type=str)) if carriers: children_prop = 'carrier-circuits' @@ -154,6 +159,7 @@ def circuit_tree(root_identifier: str): if_services = r.get(f'ims:interface_services:{root_identifier}') if if_services: + logger.debug('1') root_identifiers = [s['id'] for s in json.loads(if_services)] children = [] for id_ in root_identifiers: @@ -176,5 +182,4 @@ def circuit_tree(root_identifier: str): return f'No circuit found for: {root_identifier}' tree = _get_childcircuit_tree_local(root_identifier) - return f'<pre>{format_tree(tree, format_node = itemgetter(0), get_children = itemgetter(1))}</pre>'