]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: parse program only in MODE_DISCOVERY
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Thu, 10 Oct 2024 21:50:59 +0000 (23:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
This patch is a part of series to reintroduce the program support in the new
master-worker architecture.

Master process launches external programs, so it needs to read program
section. Thus, it should be parsed in MODE_DISCOVERY. Worker does not need
program settings, so let's check the runtime mode in cfg_parse_program. Worker
should always skip this section.

src/mworker-prog.c

index e15dc16e04a7b04e5638abf08bb5e4451336cdf5..59c0fee1d9f38d68c4308b8a6401073886f6bfb0 100644 (file)
@@ -137,6 +137,9 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm)
        struct mworker_proc *child;
        int err_code = 0;
 
+       if (!(global.mode & MODE_DISCOVERY))
+               return err_code;
+
        if (strcmp(args[0], "program") == 0) {
                if (alertif_too_many_args(1, file, linenum, args, &err_code)) {
                        err_code |= ERR_ABORT;
@@ -331,6 +334,9 @@ int cfg_program_postparser()
        int err_code = 0;
        struct mworker_proc *child;
 
+       if (!(global.mode & MODE_DISCOVERY))
+               return err_code;
+
        list_for_each_entry(child, &proc_list, list) {
                if (child->reloads == 0 && (child->options & PROC_O_TYPE_PROG)) {
                        if (child->command == NULL) {