nebraska.py: Add update_config API
This API allows to configure the parameters of nebraska using a POST
request to `update_config` API such as:
curl -d "{'critical_update': True}" -X POST https://nebraska:port/update_config
The POST data should be a JSON string representing the parameters that
need to be updated. The list of available parameters are located in
nebraska.Config glass.
There is no other behavior nor API changes for users that start the
nebraska server. Users can still pass the config as a search query
parameter.
BUG=b:181064515
TEST=./nebraska_unittest
TEST=cros flash <ip> chromiumos_test_image.bin
TEST=Start nebraska with:
nebraska.py --runtime-root=/tmp --log-file stdout --port 10000
Then pass different commands like:
curl -d '{"critical_update": true}' http://127.0.0.1:10000/update_config
curl -d '{"foo": true}' http://127.0.0.1:10000/update_config
Change-Id: I3eeea22eb5c12f6e9f903b172d533f3b6fc0cdd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2717445
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Kyle Shimabukuro <kyleshima@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: David Haddock <dhaddock@chromium.org>
4 files changed