summaryrefslogtreecommitdiffstats
path: root/nfvbench
diff options
context:
space:
mode:
authorAlec Hothan <ahothan@cisco.com>2017-09-27 18:01:25 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-27 18:01:25 +0000
commita4f1f6a51ba9a9cd8c09c49cddc577ed418ca73d (patch)
tree5b7397957dc7d57f13165e54a9e0a4d9efa5bbb8 /nfvbench
parente88c91badeaea2f1b0dbea57ead41823027441f3 (diff)
parentc5c27a690fe8ce01f047330327e5bff3afb048bd (diff)
Merge "NFVBENCH-34 Pass configuration file to entrypoint script"
Diffstat (limited to 'nfvbench')
-rw-r--r--nfvbench/nfvbenchd.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/nfvbench/nfvbenchd.py b/nfvbench/nfvbenchd.py
index 3ab30de..4657504 100644
--- a/nfvbench/nfvbenchd.py
+++ b/nfvbench/nfvbenchd.py
@@ -137,7 +137,6 @@ def setup_flask(root_path):
app.root_path = root_path
socketio = SocketIO(app, async_mode='threading')
busy_json = result_json(STATUS_ERROR, 'there is already an NFVbench request running')
- config_is_null_json = result_json(STATUS_ERROR, 'configuration is missing')
not_busy_json = result_json(STATUS_ERROR, 'no pending NFVbench run')
not_found_msg = 'results not found'
pending_msg = 'NFVbench run still pending'
@@ -169,15 +168,13 @@ def setup_flask(root_path):
@app.route('/start_run', methods=['POST'])
def start_run():
config = load_json(request.json)
- if config:
- if Ctx.is_busy():
- return jsonify(busy_json)
- else:
- request_id = get_uuid()
- Ctx.enqueue(config, request_id)
- return jsonify(result_json(STATUS_PENDING, pending_msg, request_id))
- else:
- return jsonify(config_is_null_json)
+ if not config:
+ config = {}
+ if Ctx.is_busy():
+ return jsonify(busy_json)
+ request_id = get_uuid()
+ Ctx.enqueue(config, request_id)
+ return jsonify(result_json(STATUS_PENDING, pending_msg, request_id))
@app.route('/status', defaults={'request_id': None}, methods=['GET'])
@app.route('/status/<request_id>', methods=['GET'])