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

added a simple resource for launching the router update process

parent b94bc177
No related branches found
No related tags found
No related merge requests found
......@@ -116,9 +116,9 @@ configuration are beyond the scope of this document.
The following resources can be requested from the webservice.
### synchronous resources
### resources
All responses are JSON formatted messages.
Any non-empty responses are JSON formatted messages.
* `/data/version`
......@@ -158,3 +158,7 @@ All responses are JSON formatted messages.
"items": {"type": "string"}
}
```
* /jobs/update
This resource updates the inventory network data.
\ No newline at end of file
......@@ -20,6 +20,9 @@ def create_app():
from inventory_provider import data_routes
app.register_blueprint(data_routes.routes, url_prefix='/data')
from inventory_provider import job_routes
app.register_blueprint(job_routes.routes, url_prefix='/jobs')
if "SETTINGS_FILENAME" not in os.environ:
assert False, \
"environment variable SETTINGS_FILENAME' must be defined"
......
......@@ -2,10 +2,9 @@ import functools
import json
from flask import Blueprint, request, Response, current_app
# render_template, url_for
import redis
routes = Blueprint("python-utils-ui-routes", __name__)
routes = Blueprint("inventory-data-query-routes", __name__)
VERSION = {
"api": "0.1",
......@@ -43,7 +42,7 @@ def version():
@routes.route("/routers", methods=['GET', 'POST'])
@require_accepts_json
def abc():
def routers():
redis_config = current_app.config["INVENTORY_PROVIDER_CONFIG"]["redis"]
r = redis.StrictRedis(
host=redis_config["hostname"],
......
from flask import Blueprint, Response, current_app
from inventory_provider import router_details
routes = Blueprint("inventory-data-job-routes", __name__)
@routes.route("/update", methods=['GET', 'POST'])
def update():
router_details.update_network_details(
current_app.config["INVENTORY_PROVIDER_CONFIG"])
return Response("OK")
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