]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cli: make "show env" accessible via master CLI without enabling debug
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Mon, 18 Nov 2024 09:46:33 +0000 (10:46 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 19 Nov 2024 13:13:42 +0000 (14:13 +0100)
Before this patch, we have need to put the master CLI in debug mode to be able
to issue 'show env' command for the master process. Output of this command is
handy even for the master process context, as it allows to control its
environment variables, which could be used/modified in the 'global' section.

So, let's provide in 'show env' command structure the level ACCESS_MASTER.
This allows to see and to access this command in master CLI without putting it
in debug mode.

src/cli.c

index e9952f0293fb5fab12a2f92e6cf9cf9ce14a1e52..48e58bb586d3dbcc07df76f4b6205925bf477cad 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1635,7 +1635,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
 
 
 /* parse a "show env" CLI request. Returns 0 if it needs to continue, 1 if it
- * wants to stop here. It reserves a sohw_env_ctx where it puts the variable to
+ * wants to stop here. It reserves a show_env_ctx where it puts the variable to
  * be dumped as well as a flag if a single variable is requested, otherwise puts
  * environ there.
  */
@@ -3671,7 +3671,7 @@ static struct cli_kw_list cli_kws = {{ },{
        { { "set", "severity-output",  NULL },   "set severity-output [none|number|string]: set presence of severity level in feedback information",  cli_parse_set_severity_output, NULL, NULL },
        { { "set", "timeout",  NULL },           "set timeout [cli] <delay>               : change a timeout setting",                                cli_parse_set_timeout, NULL, NULL },
        { { "show", "anon", NULL },              "show anon                               : display the current state of anonymized mode",            cli_parse_show_anon, NULL },
-       { { "show", "env",  NULL },              "show env [var]                          : dump environment variables known to the process",         cli_parse_show_env, cli_io_handler_show_env, NULL },
+       { { "show", "env",  NULL },              "show env [var]                          : dump environment variables known to the process",         cli_parse_show_env, cli_io_handler_show_env, NULL, NULL, ACCESS_MASTER },
        { { "show", "cli", "sockets",  NULL },   "show cli sockets                        : dump list of cli sockets",                                cli_parse_default, cli_io_handler_show_cli_sock, NULL, NULL, ACCESS_MASTER },
        { { "show", "cli", "level", NULL },      "show cli level                          : display the level of the current CLI session",            cli_parse_show_lvl, NULL, NULL, NULL, ACCESS_MASTER},
        { { "show", "fd", NULL },                "show fd [-!plcfbsd]* [num]              : dump list of file descriptors in use or a specific one",  cli_parse_show_fd, cli_io_handler_show_fd, NULL },