]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker/cli: indicate in the master prompt when a reload failed
authorWilly Tarreau <w@1wt.eu>
Sat, 15 Dec 2018 12:30:03 +0000 (13:30 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 15 Dec 2018 12:30:03 +0000 (13:30 +0100)
If a reload was issued to the master process and failed, it is critical
that the admin sees it because it means that the saved configuration
does not work anymore and might not be usable after a full restart. For
this reason in this case we modify the "master" prompt to explicitly
indicate that a reload failed.

doc/management.txt
src/cli.c

index ff98b7498933c9483e2631b8812266539bf96878..21719f475bcd3d9ab2a50b20928f855984811ad2 100644 (file)
@@ -2538,6 +2538,13 @@ In this example, the master has been reloaded 5 times but one of the old
 worker is still running and survived 3 reloads. You could access the CLI of
 this worker to understand what's going on.
 
+When the prompt is enabled (via the "prompt" command), the context the CLI is
+working on is displayed in the prompt. The master is identified by the "master"
+string, and other processes are identified with their PID. In case the last
+reload failed, the master prompt will be changed to "master[ReloadFailed]>" so
+that it becomes visible that the process is still running on the previous
+configuration and that the new configuration is not operational.
+
 The master CLI uses a special prefix notation to access the multiple
 processes. This notation is easily identifiable as it begins by a @.
 
index d75955d15fe4d27de2a83c7cb191302637a836bd..1a2253c49207c36fcbc72004a7cdbbfce137022d 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1718,7 +1718,8 @@ void pcli_write_prompt(struct stream *s)
                chunk_appendf(msg, "+ ");
        } else {
                if (s->pcli_next_pid == 0)
-                       chunk_appendf(msg, "master> ");
+                       chunk_appendf(msg, "master%s> ",
+                                     (global.mode & MODE_MWORKER_WAIT) ? "[ReloadFailed]" : "");
                else
                        chunk_appendf(msg, "%d> ", s->pcli_next_pid);
        }