mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
BUG/MINOR: server-state: Avoid warning on 'file not found'
On a clean installation, users might want to use server-state-file and the recommended zero-warning option. This caused a problem if server-state-file was not found, as a warning was emited, causing startup to fail. This will allow users to specify nonexistent server-state-file at first, and dump states to the file later. Fixes #2190 CF: Technically speaking, this patch can be backported to all stable versions. But it is better to do so to 2.8 only for now.
This commit is contained in:
parent
122a903b94
commit
462b54dee2
@ -799,7 +799,10 @@ void apply_server_state(void)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
f = fopen(file, "r");
|
f = fopen(file, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
ha_warning("config: Can't open global server state file '%s': %s\n", file, strerror(errno));
|
if (errno == ENOENT)
|
||||||
|
ha_notice("config: Can't open global server state file '%s': %s\n", file, strerror(errno));
|
||||||
|
else
|
||||||
|
ha_warning("config: Can't open global server state file '%s': %s\n", file, strerror(errno));
|
||||||
goto no_globalfile;
|
goto no_globalfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,8 +874,12 @@ void apply_server_state(void)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
f = fopen(file, "r");
|
f = fopen(file, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
ha_warning("Proxy '%s': Can't open server state file '%s': %s.\n",
|
if (errno == ENOENT)
|
||||||
curproxy->id, file, strerror(errno));
|
ha_notice("Proxy '%s': Can't open server state file '%s': %s.\n",
|
||||||
|
curproxy->id, file, strerror(errno));
|
||||||
|
else
|
||||||
|
ha_warning("Proxy '%s': Can't open server state file '%s': %s.\n",
|
||||||
|
curproxy->id, file, strerror(errno));
|
||||||
continue; /* next proxy */
|
continue; /* next proxy */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user