Commit b3a74ff9 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Allow to reset the child_panic counter

panic.clear gains a -z optional parameter.

Fixes #1609.
parent a64da717
......@@ -159,9 +159,17 @@ mcf_panic_show(struct cli *cli, const char * const *av, void *priv)
void __match_proto__(cli_func_t)
mcf_panic_clear(struct cli *cli, const char * const *av, void *priv)
{
(void)av;
(void)priv;
if (av[2] != NULL && strcmp(av[2], "-z")) {
VCLI_SetResult(cli, CLIS_PARAM);
VCLI_Out(cli, "Unknown parameter \"%s\".", av[2]);
return;
} else if (av[2] != NULL) {
VSC_C_mgt->child_panic = static_VSC_C_mgt.child_panic = 0;
if (child_panic == NULL)
return;
}
if (child_panic == NULL) {
VCLI_SetResult(cli, CLIS_CANT);
VCLI_Out(cli, "No panic to clear");
......
......@@ -49,6 +49,7 @@ client c1 {
varnish v1 -wait-stopped
varnish v1 -cliok "panic.show"
varnish v1 -cliok "panic.clear"
varnish v1 -expect MGT.child_panic == 1
varnish v1 -clierr 300 "panic.clear"
varnish v1 -cliok "start"
varnish v1 -wait-running
......@@ -65,7 +66,8 @@ client c1 {
varnish v1 -wait-stopped
varnish v1 -cliok "panic.show"
varnish v1 -cliok "panic.clear"
varnish v1 -cliok "panic.clear -z"
varnish v1 -expect MGT.child_panic == 0
varnish v1 -clierr 300 "panic.clear"
varnish v1 -cliok "start"
varnish v1 -wait-running
......@@ -78,3 +80,5 @@ client c1 {
rxresp
expect resp.http.foo == "foo"
} -run
varnish v1 -cliok "panic.clear -z"
......@@ -128,7 +128,7 @@ param.set <param> <value>
panic.show
Return the last panic, if any.
panic.clear
panic.clear [-z]
Clear the last panic, if any.
storage.list
......
......@@ -167,9 +167,9 @@
#define CLI_PANIC_CLEAR \
"panic.clear", \
"panic.clear", \
"panic.clear [-z]", \
"\tClear the last panic, if any.", \
0, 0
0, 1
/*
* Status/return codes in the CLI protocol
......
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