Skip to content
Snippets Groups Projects
Commit ac346fd5 authored by Robert Latta's avatar Robert Latta
Browse files

corrected paramter checking

parent 7aaaf557
No related branches found
No related tags found
No related merge requests found
import json import json
import logging
import os import os
from distutils.util import strtobool
from operator import itemgetter from operator import itemgetter
from flask import Blueprint, Response, jsonify, current_app, request from flask import Blueprint, Response, jsonify, current_app, request
...@@ -13,6 +15,7 @@ from inventory_provider.tasks import common as worker_common ...@@ -13,6 +15,7 @@ from inventory_provider.tasks import common as worker_common
routes = Blueprint("inventory-data-testing-support-routes", __name__) routes = Blueprint("inventory-data-testing-support-routes", __name__)
logger = logging.getLogger(__name__)
@routes.route("flushdb", methods=['GET', 'POST']) @routes.route("flushdb", methods=['GET', 'POST'])
def flushdb(): def flushdb():
...@@ -115,8 +118,10 @@ def latch_db(): ...@@ -115,8 +118,10 @@ def latch_db():
@routes.route("/circuit-tree/<path:root_identifier>", @routes.route("/circuit-tree/<path:root_identifier>",
methods=['GET', 'POST']) methods=['GET', 'POST'])
def circuit_tree(root_identifier: str): def circuit_tree(root_identifier: str):
carriers = request.args.get('carriers', default='false', type=str) carriers = \
interface_ = request.args.get('interface', default='false', type=str) strtobool(request.args.get('carriers', default='false', type=str))
interface_ = \
strtobool(request.args.get('interface', default='false', type=str))
if carriers: if carriers:
children_prop = 'carrier-circuits' children_prop = 'carrier-circuits'
...@@ -154,6 +159,7 @@ def circuit_tree(root_identifier: str): ...@@ -154,6 +159,7 @@ def circuit_tree(root_identifier: str):
if_services = r.get(f'ims:interface_services:{root_identifier}') if_services = r.get(f'ims:interface_services:{root_identifier}')
if if_services: if if_services:
logger.debug('1')
root_identifiers = [s['id'] for s in json.loads(if_services)] root_identifiers = [s['id'] for s in json.loads(if_services)]
children = [] children = []
for id_ in root_identifiers: for id_ in root_identifiers:
...@@ -176,5 +182,4 @@ def circuit_tree(root_identifier: str): ...@@ -176,5 +182,4 @@ def circuit_tree(root_identifier: str):
return f'No circuit found for: {root_identifier}' return f'No circuit found for: {root_identifier}'
tree = _get_childcircuit_tree_local(root_identifier) tree = _get_childcircuit_tree_local(root_identifier)
return f'<pre>{format_tree(tree, format_node = itemgetter(0), get_children = itemgetter(1))}</pre>' return f'<pre>{format_tree(tree, format_node = itemgetter(0), get_children = itemgetter(1))}</pre>'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment