BUG/MINOR: cfgparse-listen: fix warning being reported as an alert

Since b40542000d ("MEDIUM: proxy: Warn about ambiguous use of named
defaults sections") we introduced a new error to prevent user from
having an ambiguous named default section in the config which is both
inherited explicitly using "from" and implicitly by another proxy due to
the default section being the last one defined.

However, despite the error message being presented as a warning the
err_code, the commit message and the documentation, it is actually
reported as a fatal error because ha_alert() was used in place of
ha_warning().

In this patch we make the code comply with the documentation and the
intended behavior by using ha_warning() to report the error message.

This should be backported up to 2.6.
This commit is contained in:
Aurelien DARRAGON 2023-11-29 15:03:25 +01:00 committed by Christopher Faulet
parent 49293dfb65
commit eec3911e64

View File

@ -321,9 +321,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
curr_defproxy->flags |= PR_FL_IMPLICIT_REF;
if (curr_defproxy && (curr_defproxy->flags & (PR_FL_EXPLICIT_REF|PR_FL_IMPLICIT_REF)) == (PR_FL_EXPLICIT_REF|PR_FL_IMPLICIT_REF)) {
ha_alert("parsing [%s:%d] : defaults section '%s' (declared at %s:%d) is explicitly referenced by another proxy and implicitly used here."
" To avoid any ambiguity don't mix both usage. Add a last defaults section not explicitly used or always use explicit references.\n",
file, linenum, curr_defproxy->id, curr_defproxy->conf.file, curr_defproxy->conf.line);
ha_warning("parsing [%s:%d] : defaults section '%s' (declared at %s:%d) is explicitly referenced by another proxy and implicitly used here."
" To avoid any ambiguity don't mix both usage. Add a last defaults section not explicitly used or always use explicit references.\n",
file, linenum, curr_defproxy->id, curr_defproxy->conf.file, curr_defproxy->conf.line);
err_code |= ERR_WARN;
}