BUG/MINOR: server: Don't warn on server resolution failure with init-addr none

During startup, when the "none" method for "init-addr" is evaluated, a
warning is emitted if a resolution failure was previously encountered. The
documentation of the "none" method states it should be used to ignore server
resolution failures and let the server starts in DOWN state. However,
because a warning may be emitted, it is not possible to start HAProxy with
"zero-warning" option.

The same is true when "-dr" command line option is used. It is counter
intuitive and, in a way, this contradict what is specified in the
documentation.

So instead, a notice message is now emitted. At the end, if "-dr" command
line option is used or if "none" method is explicitly used, it means the
admin is agree with server resolution failures. There is no reason to emit a
warning.

This patch should fix the issue #2176. It could be backported to all stable
versions but backporting to 2.8 is probably enough for now.
This commit is contained in:
Christopher Faulet 2023-07-20 17:25:54 +02:00
parent 6ecabb3f35
commit e2e72e578e

View File

@ -4085,8 +4085,8 @@ static int srv_iterate_initaddr(struct server *srv)
case SRV_IADDR_NONE:
srv_set_admin_flag(srv, SRV_ADMF_RMAINT, SRV_ADM_STCHGC_NONE);
if (return_code) {
ha_warning("could not resolve address '%s', disabling server.\n",
name);
ha_notice("could not resolve address '%s', disabling server.\n",
name);
}
return return_code;