From 57dc69b9da6dfed1af70f4df5a94ca56166b282f Mon Sep 17 00:00:00 2001 From: bharnden Date: Sat, 24 Nov 2018 00:48:01 -0800 Subject: [PATCH] core rest - added set default services --- webapp/service_routes.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webapp/service_routes.py b/webapp/service_routes.py index ad503ceb..d9a0f014 100644 --- a/webapp/service_routes.py +++ b/webapp/service_routes.py @@ -22,11 +22,21 @@ def get_services(): @api.route("/sessions//services/default") -def get_session_options(session_id): +def get_session_service_defaults(session_id): session = core_utils.get_session(coreemu, session_id) return jsonify(defaults=session.services.default_services) +@api.route("/sessions//services/default", methods=["POST"]) +def set_session_service_defaults(session_id): + data = request.get_json() or {} + session = core_utils.get_session(coreemu, session_id) + session.services.default_services.clear() + session.services.default_services.update(data) + logger.info("default services: %s", session.services.default_services) + return jsonify() + + @api.route("/sessions//nodes//services/") def get_node_service(session_id, node_id, service_name): session = core_utils.get_session(coreemu, session_id)