mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
BUG/MINOR: spoe: Register the variable to set when an error occurred
Variables referenced in HAProxy's configuration file are registered during the configuration parsing (during parsing of "var", "set-var" or "unset-var" keywords). For the SPOE, you can use "register-var-names" directive to explicitly register variable names. All unknown variables will be rejected (unless you set "force-set-var" option). But, the variable set when an error occurred (when "set-on-error" option is defined) should also be regiestered by default. This is done with this patch.
This commit is contained in:
parent
ac580608d7
commit
b7426d1562
@ -3902,6 +3902,22 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
if (curagent->engine_id == NULL)
|
||||
curagent->engine_id = generate_pseudo_uuid();
|
||||
|
||||
if (curagent->var_on_error) {
|
||||
struct arg arg;
|
||||
|
||||
trash.len = snprintf(trash.str, trash.size, "txn.%s.%s",
|
||||
curagent->var_pfx, curagent->var_on_error);
|
||||
|
||||
arg.type = ARGT_STR;
|
||||
arg.data.str.str = trash.str;
|
||||
arg.data.str.len = trash.len;
|
||||
if (!vars_check_arg(&arg, err)) {
|
||||
memprintf(err, "SPOE agent '%s': failed to register variable %s.%s (%s)",
|
||||
curagent->id, curagent->var_pfx, curagent->var_on_error, *err);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (LIST_ISEMPTY(&curmphs) && LIST_ISEMPTY(&curgphs)) {
|
||||
ha_warning("Proxy '%s': No message/group used by SPOE agent '%s' declared at %s:%d.\n",
|
||||
px->id, curagent->id, curagent->conf.file, curagent->conf.line);
|
||||
|
Loading…
x
Reference in New Issue
Block a user