mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: server: indicate when no address was expected for a server
When parsing a peers section, it's particularly difficult to make the difference between the local peer which doesn't have any address, and other peers which need one, and the error messages do not help because with just: peers foo bind :8001 server foo 127.0.0.1:8001 server bar 127.0.0.2:8001 One can get such a confusing message when the local peer is "bar": [peers.cfg:15] : 'server foo/bar' : unknown keyword '127.0.0.1:8001'. It's not clear there why the other peer doesn't trigger an error. With this commit we add a hint in the error message when no address was expected. The error remains quite generic (since deep into the server code) but at least the useer gets a hint about why the keyword wasn't understood: [peers.cfg:15] : 'server foo/bar' : unknown keyword '127.0.0.1:8001'. Hint: no address was expected for this server.
This commit is contained in:
parent
356866acce
commit
245721b329
10
src/server.c
10
src/server.c
@ -2753,10 +2753,14 @@ static int _srv_parse_kw(struct server *srv, char **args, int *cur_arg,
|
||||
if (!kw) {
|
||||
best = srv_find_best_kw(args[*cur_arg]);
|
||||
if (best)
|
||||
ha_alert("unknown keyword '%s'; did you mean '%s' maybe ?\n",
|
||||
args[*cur_arg], best);
|
||||
ha_alert("unknown keyword '%s'; did you mean '%s' maybe ?%s\n",
|
||||
args[*cur_arg], best,
|
||||
(parse_flags & SRV_PARSE_PARSE_ADDR) ? "" :
|
||||
" Hint: no address was expected for this server.");
|
||||
else
|
||||
ha_alert("unknown keyword '%s'.\n", args[*cur_arg]);
|
||||
ha_alert("unknown keyword '%s'.%s\n", args[*cur_arg],
|
||||
(parse_flags & SRV_PARSE_PARSE_ADDR) ? "" :
|
||||
" Hint: no address was expected for this server.");
|
||||
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user