-
Notifications
You must be signed in to change notification settings - Fork 300
Emulate behaviour of haproxy-systemd-wrapper
.
#390
Conversation
aead97d
to
96023d4
Compare
ab5ac4a
to
16c9ab6
Compare
You may also care about signals propagation, see http://git.haproxy.org/?p=haproxy-1.7.git;a=commit;h=4351ea61fbddf88c960179d60b0e0f1b090f0b70 |
Correct me if I'm wrong, but I think that only matters if you're using signals to reload HAProxy, which we aren't. |
@@ -33,7 +33,7 @@ reload() { | |||
|
|||
# Trigger reload | |||
LATEST_HAPROXY_PID=$(cat $PIDFILE) | |||
haproxy -p $PIDFILE -f /marathon-lb/haproxy.cfg -D -sf $LATEST_HAPROXY_PID 200>&- | |||
/marathon-lb/haproxy_wrapper.py `which haproxy` -p $PIDFILE -f /marathon-lb/haproxy.cfg -D -sf $LATEST_HAPROXY_PID 200>&- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not fork this, must block the execution until reload is over.
test the return code, should log to stderr in case of error.
@@ -33,7 +33,7 @@ reload() { | |||
|
|||
# Trigger reload | |||
LATEST_HAPROXY_PID=$(cat $PIDFILE) | |||
haproxy -p $PIDFILE -f /marathon-lb/haproxy.cfg -D -sf $LATEST_HAPROXY_PID 200>&- | |||
/marathon-lb/haproxy_wrapper.py `which haproxy` -p $PIDFILE -f /marathon-lb/haproxy.cfg -D -sf $LATEST_HAPROXY_PID 200>&- | |||
if [ -n "${HAPROXY_RELOAD_SIGTERM_DELAY-}" ]; then | |||
sleep $HAPROXY_RELOAD_SIGTERM_DELAY && kill $LATEST_HAPROXY_PID 200>&- 2>/dev/null & | |||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HAPROXY_RELOAD_SIGTERM_DELAY is no longer needed
if len(ret) == 0: | ||
close_and_swallow(pipefd[0]) | ||
close_and_swallow(pipefd[1]) | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is empty ret an error case ? if not should return True here
# Close the write side | ||
os.close(pipefd[1]) | ||
while wait_on_haproxy_pipe(pipefd): | ||
time.sleep(0.01) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add an explicit exit code / error message
3eb9900
to
42a70ae
Compare
0173b24
to
0cd1916
Compare
This also drops the `HAPROXY_RELOAD_SIGTERM_DELAY` param. For reference, see: http://git.haproxy.org/?p=haproxy.git;a=blob;f=src/haproxy-systemd-wrapper.c;h=f6a9c852b277b5f193d6a952119a149b4cfe3e8b;hb=HEAD
This seems to be working now. I'm going to go ahead and merge it soon. |
For reference, see:
http://git.haproxy.org/?p=haproxy.git;a=blob;f=src/haproxy-systemd-wrapper.c;h=f6a9c852b277b5f193d6a952119a149b4cfe3e8b;hb=HEAD