mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-17 00:44:33 +00:00
REORG: cli: move "{enable|disable} server" to server.c
Also mention that "set server" is preferred now.
This commit is contained in:
parent
15b9e68a78
commit
ffb4d58e1b
20
src/cli.c
20
src/cli.c
@ -691,16 +691,6 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||
sv->check.state |= CHK_ST_ENABLED;
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(args[1], "server") == 0) {
|
||||
struct server *sv;
|
||||
|
||||
sv = expect_server_admin(s, si, args[2]);
|
||||
if (!sv)
|
||||
return 1;
|
||||
|
||||
srv_adm_set_ready(sv);
|
||||
return 1;
|
||||
}
|
||||
else { /* unknown "enable" parameter */
|
||||
appctx->ctx.cli.msg = "'enable' only supports 'agent', 'frontend', 'health', and 'server'.\n";
|
||||
appctx->st0 = STAT_CLI_PRINT;
|
||||
@ -728,16 +718,6 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||
sv->check.state &= ~CHK_ST_ENABLED;
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(args[1], "server") == 0) {
|
||||
struct server *sv;
|
||||
|
||||
sv = expect_server_admin(s, si, args[2]);
|
||||
if (!sv)
|
||||
return 1;
|
||||
|
||||
srv_adm_set_maint(sv);
|
||||
return 1;
|
||||
}
|
||||
else { /* unknown "disable" parameter */
|
||||
appctx->ctx.cli.msg = "'disable' only supports 'agent', 'frontend', 'health', and 'server'.\n";
|
||||
appctx->st0 = STAT_CLI_PRINT;
|
||||
|
34
src/server.c
34
src/server.c
@ -3583,8 +3583,42 @@ static int cli_parse_set_maxconn_server(char **args, struct appctx *appctx, void
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* parse a "disable server" command. It always returns 1. */
|
||||
static int cli_parse_disable_server(char **args, struct appctx *appctx, void *private)
|
||||
{
|
||||
struct server *sv;
|
||||
|
||||
if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))
|
||||
return 1;
|
||||
|
||||
sv = cli_find_server(appctx, args[2]);
|
||||
if (!sv)
|
||||
return 1;
|
||||
|
||||
srv_adm_set_maint(sv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* parse a "enable server" command. It always returns 1. */
|
||||
static int cli_parse_enable_server(char **args, struct appctx *appctx, void *private)
|
||||
{
|
||||
struct server *sv;
|
||||
|
||||
if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))
|
||||
return 1;
|
||||
|
||||
sv = cli_find_server(appctx, args[2]);
|
||||
if (!sv)
|
||||
return 1;
|
||||
|
||||
srv_adm_set_ready(sv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* register cli keywords */
|
||||
static struct cli_kw_list cli_kws = {{ },{
|
||||
{ { "disable", "server", NULL }, "disable server : disable a server for maintenance (use 'set server' instead)", cli_parse_disable_server, NULL },
|
||||
{ { "enable", "server", NULL }, "enable server : enable a disabled server (use 'set server' instead)", cli_parse_enable_server, NULL },
|
||||
{ { "set", "maxconn", "server", NULL }, "set maxconn server : change a server's maxconn setting", cli_parse_set_maxconn_server, NULL },
|
||||
{ { "set", "server", NULL }, "set server : change a server's state, weight or address", cli_parse_set_server },
|
||||
{ { "get", "weight", NULL }, "get weight : report a server's current weight", cli_parse_get_weight },
|
||||
|
Loading…
Reference in New Issue
Block a user