]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: server: support both check/agent-check on a dynamic instance
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 10 Aug 2021 14:24:36 +0000 (16:24 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 11 Aug 2021 12:41:47 +0000 (14:41 +0200)
A static server is able to support simultaneously both health chech and
agent-check. Adjust the dynamic server CLI handlers to also support this
configuration.

This should not be backported, unless dynamic server checks are
backported.

src/server.c

index 6405c3636fae60f09a40b431f6f3de94689bf233..f1e294a836bacf3ffcddc728c62cf00041947866 100644 (file)
@@ -4579,7 +4579,8 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
                srv->check.state &= ~CHK_ST_ENABLED;
                srv_use_dynsrv(srv);
        }
-       else if (srv->do_agent) {
+
+       if (srv->do_agent) {
                if (init_srv_agent_check(srv))
                        goto out;
 
@@ -4647,7 +4648,7 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
                if (!start_check_task(&srv->check, 0, 1, 1))
                        ha_alert("System might be unstable, consider to execute a reload");
        }
-       else if (srv->agent.state & CHK_ST_CONFIGURED) {
+       if (srv->agent.state & CHK_ST_CONFIGURED) {
                if (!start_check_task(&srv->agent, 0, 1, 1))
                        ha_alert("System might be unstable, consider to execute a reload");
        }
@@ -4664,7 +4665,7 @@ out:
 
                if (srv->check.state & CHK_ST_CONFIGURED)
                        free_check(&srv->check);
-               else if (srv->agent.state & CHK_ST_CONFIGURED)
+               if (srv->agent.state & CHK_ST_CONFIGURED)
                        free_check(&srv->agent);
 
                /* remove the server from the proxy linked list */
@@ -4773,7 +4774,7 @@ static int cli_parse_delete_server(char **args, char *payload, struct appctx *ap
        /* stop the check task if running */
        if (srv->check.state & CHK_ST_CONFIGURED)
                check_purge(&srv->check);
-       else if (srv->agent.state & CHK_ST_CONFIGURED)
+       if (srv->agent.state & CHK_ST_CONFIGURED)
                check_purge(&srv->agent);
 
        /* detach the server from the proxy linked list