From 4d04c1fb18bb3a9a78e4de7a2a574845b254ad39 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 23 Aug 2016 14:04:20 -0400 Subject: [PATCH] Add break and reopen to http consoles HTTP console API did not have a means to send break or request session reopen. Rectify this discrepency by adding an 'action' key to request certain console specific actions. In retrospect, closing the session should have just been an 'action', but leaving things as-is. --- confluent_server/confluent/httpapi.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index 4e9e197f..74ed89c5 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -349,7 +349,7 @@ def resourcehandler_backend(env, start_response): del querydict['restexplorerop'] authorized = _authorize_request(env, operation) if 'logout' in authorized: - start_response('200 Sucessful logout', headers) + start_response('200 Successful logout', headers) yield('{"result": "200 - Successful logout"}') return if 'HTTP_SUPPRESSAUTHHEADER' in env: @@ -461,6 +461,17 @@ def resourcehandler_backend(env, start_response): start_response('200 OK', headers) yield '{"sessionclosed": true}' return + elif 'action' in querydict: + if querydict['action'] == 'break': + consolesessions[querydict['session']]['session'].send_break() + elif querydict['action'] == 'reopen': + consolesessions[querydict['session']]['session'].reopen() + else: + start_response('400 Bad Request') + yield 'Unrecognized action ' + querydict['action'] + return + start_response('200 OK', headers) + yield json.dumps({'session': querydict['session']}) else: # no keys, but a session, means it's hooking to receive data sessid = querydict['session'] if sessid not in consolesessions: