]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mworker-prog: don't warn about deprecated section with expose-deprecated...
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 19 Nov 2024 09:32:28 +0000 (10:32 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 19 Nov 2024 13:13:30 +0000 (14:13 +0100)
As master parses now expose-deprecated-directives option, let's emit warning
about deprecated 'progam' section only in case, if this option wasn't set in
the 'global' section. This allows to people, who don't prefer to remove the
'program' section immediately to continue to start the process in zero-warning
mode.

Adjust the warning message accordingly and mcli_start_progs.vtc test. As
expose-deprecated-directives option is a 'global' section keyword, this section
must always precede any 'program' section, if users still continue to keep
'program' section.

This doesn't need to be backported, as related to the latest changes in
the master-worker architecture.

reg-tests/mcli/mcli_start_progs.vtc
src/mworker-prog.c

index c812288e01964989253860124f131e67f6a3a5bc..489efff7ee2ff072e659f81d294c7f66da83a410 100644 (file)
@@ -9,6 +9,8 @@ server s1 {
 } -start
 
 haproxy h1 -W -S -conf {
+    global
+        expose-deprecated-directives
     defaults
         mode http
         timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
index 88ff1fc9f8ccc73bd86b70033f9f5046731a19b5..6aa9ec8ce894967d74a31a33adeba2eccfd72cd0 100644 (file)
@@ -194,9 +194,15 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm)
                        goto error;
                }
 
-               ha_warning("parsing [%s:%d]: The '%s' section is deprecated and will eventually be removed, please consider "
-                          "using a process manager instead, such as sysvinit, systemd, supervisord or s6\n",
-                          file, linenum, args[0]);
+               if (!deprecated_directives_allowed) {
+                       ha_warning("parsing [%s:%d]: The 'program' section is deprecated and will be eventually removed, "
+                                  "it can be still allowed by setting 'expose-deprecated-directives' keyword in the 'global' "
+                                  "section defined before any 'program' section. Please, consider to use a process manager instead "
+                                  "of 'program' section, such as sysvinit, systemd, supervisord or s6.\n",
+                                  file, linenum);
+                       err_code |= ERR_ALERT | ERR_ABORT;
+                       goto error;
+               }
 
                LIST_APPEND(&proc_list, &ext_child->list);