BUG/MINOR: peers: detect and warn on init_addr/resolvers/check/agent-check

Some server keywords are currently silently ignored in the peers
section, which is not good because it wastes time on user-side, trying
to make something work while it cannot by design.

With this patch we at least report a few of them (the most common ones),
which are init_addr, resolvers, check, agent-check. Others might follow.

This may be backported to 2.5 to encourage some cleaning of bogus configs.
This commit is contained in:
Willy Tarreau 2022-05-31 09:42:44 +02:00
parent 245721b329
commit 824c8c5999

View File

@ -896,6 +896,12 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
goto out;
}
if (curpeers->peers_fe->srv->init_addr_methods || curpeers->peers_fe->srv->resolvers_id ||
curpeers->peers_fe->srv->do_check || curpeers->peers_fe->srv->do_agent) {
ha_warning("parsing [%s:%d] : '%s %s' : init_addr, resolvers, check and agent are ignored for peers.\n", file, linenum, args[0], args[1]);
err_code |= ERR_WARN;
}
/* If the peer address has just been parsed, let's copy it to <newpeer>
* and initializes ->proto.
*/