]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config: silence .notice/.warning/.alert in discovery mode
authorWilly Tarreau <w@1wt.eu>
Tue, 1 Apr 2025 07:06:25 +0000 (09:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 1 Apr 2025 07:06:25 +0000 (09:06 +0200)
When first pre-parsing the config to detect the presence or absence of
the master mode, we must not emit messages because they are not supposed
to be visible at this point, otherwise they appear twice each. The
pre-parsing, also called discovery mode, is only for internal use,
thus it should remain silent.

This should be backported to 3.1 where this mode was introduced.

src/cfgparse.c

index c7c31b418ff7077e4b2c1832d817ba984d5cce61..4fe2da9786fd954e16ecd75906ae9558ba3b9203 100644 (file)
@@ -2506,7 +2506,7 @@ next_line:
                }
 
                /* .warning/.error/.notice/.diag */
-               if (*args[0] == '.') {
+               if (*args[0] == '.' && !(global.mode & MODE_DISCOVERY)) {
                        if (strcmp(args[0], ".alert") == 0) {
                                if (*args[2]) {
                                        ha_alert("parsing [%s:%d]: Unexpected argument '%s' for '%s'. Use quotes if the message should contain spaces.\n",