Commit dbfa7b42 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Nitpicking around the corners of vcl labels

parent 75f8e5ec
......@@ -437,7 +437,9 @@ mcf_vcl_discard(struct cli *cli, const char * const *av, void *priv)
if (vp->label != NULL) {
AN(vp->warm);
VCLI_SetResult(cli, CLIS_PARAM);
VCLI_Out(cli, "Must remove label to discard VCL\n");
VCLI_Out(cli,
"Cannot discard labeled (\"%s\") VCL program.\n",
vp->label->name);
return;
}
(void)mgt_vcl_setstate(cli, vp, VCL_STATE_COLD);
......@@ -500,6 +502,12 @@ mcf_vcl_label(struct cli *cli, const char * const *av, void *priv)
VCLI_Out(cli, "VCL labels cannot point to labels");
return;
}
if (vpt->label != NULL) {
VCLI_SetResult(cli, CLIS_PARAM);
VCLI_Out(cli, "VCL already labeled (\"%s\")",
vpt->label->name);
return;
}
vpl = mgt_vcl_byname(av[2]);
if (vpl == NULL)
vpl = mgt_vcl_add(av[2], NULL, VCL_STATE_LABEL);
......@@ -511,8 +519,10 @@ mcf_vcl_label(struct cli *cli, const char * const *av, void *priv)
}
vpl->warm = 1;
if (vpl->label != NULL) {
assert(vpl->label->label == vpl);
/* XXX SET vp->label AUTO */
vpl->label->label = NULL;
/* XXX SET AUTO */
vpl->label = NULL;
}
vpl->label = vpt;
vpt->label = vpl;
......
......@@ -31,7 +31,11 @@ client c1 {
varnish v1 -cliok "vcl.list"
varnish v1 -clierr 106 "vcl.label foo vcl0"
varnish v1 -cliok "vcl.label foo vcl2"
varnish v1 -clierr 106 "vcl.label bar vcl2"
varnish v1 -clierr 106 "vcl.discard vcl2"
varnish v1 -cliok "vcl.label foo vcl1"
varnish v1 -clierr 106 "vcl.label vcl1 vcl2"
varnish v1 -clierr 106 "vcl.state foo cold"
varnish v1 -clierr 106 "vcl.label bar foo"
varnish v1 -clierr 106 "vcl.discard vcl1"
......
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