diff options
author | ILYA Khlopotov <iilyak@apache.org> | 2018-08-07 12:01:31 -0700 |
---|---|---|
committer | ILYA Khlopotov <iilyak@apache.org> | 2018-08-15 15:40:42 -0700 |
commit | 0cb1110177e684eff3f1ac9a3117932eb6bdcc7b (patch) | |
tree | 1e12b59f42dbf60ff3a07a1bf4520111ef966c1f | |
parent | 28ba48da5877a5d471253c1b587af7e3b3121fd9 (diff) | |
download | couchdb-0cb1110177e684eff3f1ac9a3117932eb6bdcc7b.tar.gz |
Add `POST /_node/$node/_restart` endpoint
We need to be able to restart CouchDB from integration test suite.
We used to have this feature, but it was removed.
This PR brings this functionality back under `/_node/$node/_restart`.
-rw-r--r-- | src/chttpd/src/chttpd_misc.erl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl index 596e0142b..4a9324415 100644 --- a/src/chttpd/src/chttpd_misc.erl +++ b/src/chttpd/src/chttpd_misc.erl @@ -344,6 +344,12 @@ handle_node_req(#httpd{method='GET', path_parts=[_, Node, <<"_system">>]}=Req) - send_json(Req, EJSON); handle_node_req(#httpd{path_parts=[_, _Node, <<"_system">>]}=Req) -> send_method_not_allowed(Req, "GET"); +% POST /_node/$node/_restart +handle_node_req(#httpd{method='POST', path_parts=[_, Node, <<"_restart">>]}=Req) -> + call_node(Node, init, restart, []), + send_json(Req, 200, {[{ok, true}]}); +handle_node_req(#httpd{path_parts=[_, _Node, <<"_restart">>]}=Req) -> + send_method_not_allowed(Req, "POST"); handle_node_req(#httpd{path_parts=[_]}=Req) -> chttpd:send_error(Req, {bad_request, <<"Incomplete path to _node request">>}); handle_node_req(#httpd{path_parts=[_, _Node]}=Req) -> |