mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: mworker/cli: add flags in the prompt
The master CLI prompt is now able to show flags in its prompt depending on the mode used: experimental (x), expert (e), mcli-debug (d).
This commit is contained in:
parent
2a17191e91
commit
dae12c7553
@ -3675,14 +3675,14 @@ Example:
|
|||||||
expert-mode [on|off]
|
expert-mode [on|off]
|
||||||
This command activates the "expert-mode" for every worker accessed from the
|
This command activates the "expert-mode" for every worker accessed from the
|
||||||
master CLI. Combined with "mcli-debug-mode" it also activates the command on
|
master CLI. Combined with "mcli-debug-mode" it also activates the command on
|
||||||
the master.
|
the master. Display the flag "e" in the master CLI prompt.
|
||||||
|
|
||||||
See also "expert-mode" in Section 9.3 and "mcli-debug-mode" in 9.4.1.
|
See also "expert-mode" in Section 9.3 and "mcli-debug-mode" in 9.4.1.
|
||||||
|
|
||||||
experimental-mode [on|off]
|
experimental-mode [on|off]
|
||||||
This command activates the "experimental-mode" for every worker accessed from
|
This command activates the "experimental-mode" for every worker accessed from
|
||||||
the master CLI. Combined with "mcli-debug-mode" it also activates the command on
|
the master CLI. Combined with "mcli-debug-mode" it also activates the command on
|
||||||
the master.
|
the master. Display the flag "x" in the master CLI prompt.
|
||||||
|
|
||||||
See also "experimental-mode" in Section 9.3 and "mcli-debug-mode" in 9.4.1.
|
See also "experimental-mode" in Section 9.3 and "mcli-debug-mode" in 9.4.1.
|
||||||
|
|
||||||
@ -3691,7 +3691,7 @@ mcli-debug-mode [on|off]
|
|||||||
keywords that were meant for a worker CLI on the master CLI, allowing to debug
|
keywords that were meant for a worker CLI on the master CLI, allowing to debug
|
||||||
the master process. Once activated, you list the new available keywords with
|
the master process. Once activated, you list the new available keywords with
|
||||||
"help". Combined with "experimental-mode" or "expert-mode" it enables even
|
"help". Combined with "experimental-mode" or "expert-mode" it enables even
|
||||||
more keywords.
|
more keywords. Display the flag "d" in the master CLI prompt.
|
||||||
|
|
||||||
prompt
|
prompt
|
||||||
When the prompt is enabled (via the "prompt" command), the context the CLI is
|
When the prompt is enabled (via the "prompt" command), the context the CLI is
|
||||||
@ -3701,6 +3701,19 @@ prompt
|
|||||||
that it becomes visible that the process is still running on the previous
|
that it becomes visible that the process is still running on the previous
|
||||||
configuration and that the new configuration is not operational.
|
configuration and that the new configuration is not operational.
|
||||||
|
|
||||||
|
The prompt of the master CLI is able to display several flags which are the
|
||||||
|
enable modes. "d" for mcli-debug-mode, "e" for expert-mode, "x" for
|
||||||
|
experimental-mode.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
$ socat /var/run/haproxy-master.sock -
|
||||||
|
prompt
|
||||||
|
master> expert-mode on
|
||||||
|
master(e)> experimental-mode on
|
||||||
|
master(xe)> mcli-debug-mode on
|
||||||
|
master(xed)> @1
|
||||||
|
95191(xed)>
|
||||||
|
|
||||||
reload
|
reload
|
||||||
You can also reload the HAProxy master process with the "reload" command which
|
You can also reload the HAProxy master process with the "reload" command which
|
||||||
does the same as a `kill -USR2` on the master process, provided that the user
|
does the same as a `kill -USR2` on the master process, provided that the user
|
||||||
|
23
src/cli.c
23
src/cli.c
@ -2127,10 +2127,29 @@ void pcli_write_prompt(struct stream *s)
|
|||||||
chunk_appendf(msg, "+ ");
|
chunk_appendf(msg, "+ ");
|
||||||
} else {
|
} else {
|
||||||
if (s->pcli_next_pid == 0)
|
if (s->pcli_next_pid == 0)
|
||||||
chunk_appendf(msg, "master%s> ",
|
chunk_appendf(msg, "master%s",
|
||||||
(proc_self->failedreloads > 0) ? "[ReloadFailed]" : "");
|
(proc_self->failedreloads > 0) ? "[ReloadFailed]" : "");
|
||||||
else
|
else
|
||||||
chunk_appendf(msg, "%d> ", s->pcli_next_pid);
|
chunk_appendf(msg, "%d", s->pcli_next_pid);
|
||||||
|
|
||||||
|
if (s->pcli_flags & (ACCESS_EXPERIMENTAL|ACCESS_EXPERT|ACCESS_MCLI_DEBUG)) {
|
||||||
|
chunk_appendf(msg, "(");
|
||||||
|
|
||||||
|
if (s->pcli_flags & ACCESS_EXPERIMENTAL)
|
||||||
|
chunk_appendf(msg, "x");
|
||||||
|
|
||||||
|
if (s->pcli_flags & ACCESS_EXPERT)
|
||||||
|
chunk_appendf(msg, "e");
|
||||||
|
|
||||||
|
if (s->pcli_flags & ACCESS_MCLI_DEBUG)
|
||||||
|
chunk_appendf(msg, "d");
|
||||||
|
|
||||||
|
chunk_appendf(msg, ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk_appendf(msg, "> ");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
co_inject(oc, msg->area, msg->data);
|
co_inject(oc, msg->area, msg->data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user