Skip to content
Snippets Groups Projects
Commit 97eda521 authored by Erik Reid's avatar Erik Reid
Browse files

added /data/debug-dump/<hostname> route

parent 93924cff
No related branches found
No related tags found
No related merge requests found
......@@ -20,4 +20,5 @@ logging.basicConfig(
app = inventory_provider.create_app()
if __name__ == "__main__":
app.run(host="::", port="7777")
# app.run(host="::", port="7777")
app.run(host="::", port="7878")
......@@ -83,3 +83,24 @@ def router_interfaces(hostname):
return Response(
json.dumps(interfaces),
mimetype="application/json")
@routes.route("/debug-dump/<hostname>", methods=['GET', 'POST'])
@require_accepts_json
def debug_dump_router_info(hostname):
redis_config = current_app.config["INVENTORY_PROVIDER_CONFIG"]["redis"]
r = redis.StrictRedis(
host=redis_config["hostname"],
port=redis_config["port"])
info = dict([(k.decode('utf-8'), json.loads(v.decode('utf-8')))
for k,v in r.hgetall(hostname).items()])
if not info:
return Response(
response="no info found for router '%s'" % hostname,
status=404,
mimetype="text/html")
return Response(
json.dumps(info),
mimetype="application/json")
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