BUG/MINOR: vars: properly set the argument parsing context in the expression
authorWilly Tarreau <w@1wt.eu>
Thu, 2 Sep 2021 17:46:08 +0000 (19:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Nov 2021 15:33:48 +0000 (16:33 +0100)
commitf2846f7377130573523e697a5ca0a557f73e4ef3
treea8b20346a3f56d9d36e9229f1225c56f19f1aa95
parenta281a54495dfec2cc2e10f52ec1f5d0f8a500cb4
BUG/MINOR: vars: properly set the argument parsing context in the expression

When the expression called in "set-var" uses argments that require late
resolution, the context must be set. At the moment, any unknown argument
is misleadingly reported as "ACL":

    frontend f
        bind :8080
        mode http
        http-request set-var(proc.a) be_conn(foo)

   parsing [b1.cfg:4]: unable to find backend 'foo' referenced in arg 1 \
   of ACL keyword 'be_conn' in proxy 'f'.

Once the context is properly set, it now says the truth:

   parsing [b1.cfg:8]: unable to find backend 'foo' referenced in arg 1 \
   of sample fetch keyword 'be_conn' in http-request expression in proxy 'f'.

This may be backported but is not really important. If so, the preceeding
patches "BUG/MINOR: vars: improve accuracy of the rules used to check
expression validity" and "MINOR: sample: add missing ARGC_ entries" must
be backported as well.

(cherry picked from commit 54b96d99556a27e15ee77b8b498d011cda2771e9)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit a59858fe2410c07670b7a2d00f4c0e1aa9a67bf1)
[cf: backported to ease other backports]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/vars.c