Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
haproxy_wrapper fixes. (#406)
Browse files Browse the repository at this point in the history
- set pipe to inheritable (this changed in Python 3.4, and I missed it
   in my previous testing)
 - run HAProxy in daemon mode (durr)
  • Loading branch information
brndnmtthws authored Jan 19, 2017
1 parent 5a3f13f commit 3857b37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions haproxy_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

def create_haproxy_pipe():
pipefd = os.pipe()
os.set_inheritable(pipefd[0], True)
os.set_inheritable(pipefd[1], True)
return pipefd


Expand All @@ -24,6 +26,7 @@ def wait_on_haproxy_pipe(pipefd):
if len(ret) == 0:
close_and_swallow(pipefd[0])
close_and_swallow(pipefd[1])
return False
except OSError as e:
if e.args[0] != errno.EINTR:
close_and_swallow(pipefd[0])
Expand Down
2 changes: 1 addition & 1 deletion service/haproxy/run
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ reload() {

# Trigger reload
LATEST_HAPROXY_PID=$(cat $PIDFILE)
/marathon-lb/haproxy_wrapper.py `which haproxy` -p $PIDFILE -f /marathon-lb/haproxy.cfg -sf $LATEST_HAPROXY_PID 200>&-
/marathon-lb/haproxy_wrapper.py `which haproxy` -D -p $PIDFILE -f /marathon-lb/haproxy.cfg -sf $LATEST_HAPROXY_PID 200>&-
local exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "HAProxy reload failed" 1>&2
Expand Down

0 comments on commit 3857b37

Please sign in to comment.