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

require accepts json

parent 4f9329c8
No related branches found
No related tags found
No related merge requests found
from flask import Blueprint, Response, current_app, jsonify from flask import Blueprint, Response, current_app, jsonify
from inventory_provider.tasks import worker from inventory_provider.tasks import worker
from inventory_provider.routes import common
routes = Blueprint("inventory-data-job-routes", __name__) routes = Blueprint("inventory-data-job-routes", __name__)
@routes.route("/update", methods=['GET', 'POST']) @routes.route("/update", methods=['GET', 'POST'])
@common.require_accepts_json
def update(): def update():
job_ids = worker.launch_refresh_cache_all( job_ids = worker.launch_refresh_cache_all(
current_app.config["INVENTORY_PROVIDER_CONFIG"]) current_app.config["INVENTORY_PROVIDER_CONFIG"])
...@@ -18,11 +20,13 @@ def update_interface_statuses(): ...@@ -18,11 +20,13 @@ def update_interface_statuses():
@routes.route("reload-router-config/<equipment_name>", methods=['GET', 'POST']) @routes.route("reload-router-config/<equipment_name>", methods=['GET', 'POST'])
@common.require_accepts_json
def reload_router_config(equipment_name): def reload_router_config(equipment_name):
result = worker.reload_router_config.delay(equipment_name) result = worker.reload_router_config.delay(equipment_name)
return jsonify([result.id]) return jsonify([result.id])
@routes.route("check-task-status/<task_id>", methods=['GET', 'POST']) @routes.route("check-task-status/<task_id>", methods=['GET', 'POST'])
@common.require_accepts_json
def check_task_status(task_id): def check_task_status(task_id):
return jsonify(worker.check_task_status(task_id)) return jsonify(worker.check_task_status(task_id))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment