Commit ee8f4f48 authored by Geoff Simmons's avatar Geoff Simmons

Add JSON support for the CLI "status" command.

parent 7e070837
......@@ -679,8 +679,19 @@ mch_cli_server_status(struct cli *cli, const char * const *av, void *priv)
VCLI_Out(cli, "Child in state %s", ch_state[child_state]);
}
static void v_matchproto_(cli_func_t)
mch_cli_server_status_json(struct cli *cli, const char * const *av, void *priv)
{
(void)priv;
VCLI_JSON_begin(cli, 2, av);
VCLI_Out(cli, ", ");
VCLI_JSON_str(cli, ch_state[child_state]);
VCLI_JSON_end(cli);
}
static struct cli_proto cli_mch[] = {
{ CLICMD_SERVER_STATUS, "", mch_cli_server_status },
{ CLICMD_SERVER_STATUS, "", mch_cli_server_status,
mch_cli_server_status_json },
{ CLICMD_SERVER_START, "", mch_cli_server_start },
{ CLICMD_SERVER_STOP, "", mch_cli_server_stop },
{ CLICMD_PANIC_SHOW, "", mch_cli_panic_show },
......
......@@ -7,7 +7,11 @@ server s1 {
varnish v1 -vcl+backend { }
varnish v1 -start
varnish v1 -cliexpect "running" status
varnish v1 -clijson "status -j"
varnish v1 -stop
varnish v1 -cliexpect "stopped" status
varnish v1 -clijson "status -j"
varnish v1 -start
varnish v1 -stop
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment