Commit b23dddd3 authored by Guillaume Quintard's avatar Guillaume Quintard Committed by guillaume quintard

Add param.reset command to varnishadm

parent d8ae26b5
...@@ -505,6 +505,8 @@ MCF_ParamSet(struct cli *cli, const char *param, const char *val) ...@@ -505,6 +505,8 @@ MCF_ParamSet(struct cli *cli, const char *param, const char *val)
VCLI_Out(cli, "parameter \"%s\" is protected.", param); VCLI_Out(cli, "parameter \"%s\" is protected.", param);
return; return;
} }
if (!val)
val = pp->def;
if (pp->func(cli->sb, pp, val)) if (pp->func(cli->sb, pp, val))
VCLI_SetResult(cli, CLIS_PARAM); VCLI_SetResult(cli, CLIS_PARAM);
...@@ -534,6 +536,16 @@ mcf_param_set(struct cli *cli, const char * const *av, void *priv) ...@@ -534,6 +536,16 @@ mcf_param_set(struct cli *cli, const char * const *av, void *priv)
MCF_ParamSet(cli, av[2], av[3]); MCF_ParamSet(cli, av[2], av[3]);
} }
/*--------------------------------------------------------------------*/
static void v_matchproto_(cli_func_t)
mcf_param_reset(struct cli *cli, const char * const *av, void *priv)
{
(void)priv;
MCF_ParamSet(cli, av[2], NULL);
}
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* Add a group of parameters to the global set and sort by name. * Add a group of parameters to the global set and sort by name.
*/ */
...@@ -595,6 +607,7 @@ static struct cli_proto cli_params[] = { ...@@ -595,6 +607,7 @@ static struct cli_proto cli_params[] = {
{ CLICMD_PARAM_SHOW, "", mcf_param_show, { CLICMD_PARAM_SHOW, "", mcf_param_show,
mcf_param_show_json }, mcf_param_show_json },
{ CLICMD_PARAM_SET, "", mcf_param_set }, { CLICMD_PARAM_SET, "", mcf_param_set },
{ CLICMD_PARAM_RESET, "", mcf_param_reset },
{ NULL } { NULL }
}; };
......
...@@ -38,6 +38,12 @@ varnish v1 -clijson "ping -j" ...@@ -38,6 +38,12 @@ varnish v1 -clijson "ping -j"
varnish v1 -clierr 106 "param.set waiter HASH(0x8839c4c)" varnish v1 -clierr 106 "param.set waiter HASH(0x8839c4c)"
varnish v1 -cliexpect 60 "param.show first_byte_timeout"
varnish v1 -cliok "param.set first_byte_timeout 120"
varnish v1 -cliexpect 120 "param.show first_byte_timeout"
varnish v1 -cliok "param.reset first_byte_timeout"
varnish v1 -cliexpect 60 "param.show first_byte_timeout"
varnish v1 -cliok "param.set cli_limit 128" varnish v1 -cliok "param.set cli_limit 128"
varnish v1 -clierr 201 "param.show" varnish v1 -clierr 201 "param.show"
...@@ -110,6 +110,8 @@ Varnish Cache trunk (ongoing) ...@@ -110,6 +110,8 @@ Varnish Cache trunk (ongoing)
* added ``req.is_hitmiss`` and ``req.is_hitpass`` (2743_) * added ``req.is_hitmiss`` and ``req.is_hitpass`` (2743_)
* Add ``param.reset`` command to ``varnishadm``
.. _2809: https://github.com/varnishcache/varnish-cache/issues/2809 .. _2809: https://github.com/varnishcache/varnish-cache/issues/2809
.. _2820: https://github.com/varnishcache/varnish-cache/issues/2820 .. _2820: https://github.com/varnishcache/varnish-cache/issues/2820
.. _2815: https://github.com/varnishcache/varnish-cache/issues/2815 .. _2815: https://github.com/varnishcache/varnish-cache/issues/2815
......
...@@ -133,6 +133,14 @@ CLI_CMD(VCL_LABEL, ...@@ -133,6 +133,14 @@ CLI_CMD(VCL_LABEL,
2, 2 2, 2
) )
CLI_CMD(PARAM_RESET,
"param.reset",
"param.reset <param>",
"Reset parameter to default value.",
"",
1,1
)
CLI_CMD(PARAM_SHOW, CLI_CMD(PARAM_SHOW,
"param.show", "param.show",
"param.show [-l|-j] [<param>|changed]", "param.show [-l|-j] [<param>|changed]",
......
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