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

Commit

Permalink
Swap env var used to determine socket activation
Browse files Browse the repository at this point in the history
For reasons I don't fully understand, LISTEN_PID and LISTEN_FDS are
missing by the time execution gets here. LISTEN_FDNAMES still exists
though.
  • Loading branch information
ipmb committed May 15, 2018
1 parent d2de9da commit 1d43118
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions saltdash/core/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ class NonBindingServer(waitress.server.UnixWSGIServer):
def bind_server_socket(self):
pass


def _is_systemd():
listen_pid = int(os.environ.get("LISTEN_PID", 0))
return listen_pid == os.getpid()


def systemd_notify(msg):
"""
Allow app to be setup as `Type=notify` in systemd
Expand All @@ -50,7 +44,7 @@ def start():
"""Start webserver"""
logged_app = TransLogger(wsgi.application)
# Work with systemd socket activation
if _is_systemd() and not config.LISTEN:
if 'LISTEN_FDNAMES' in os.environ and not config.LISTEN:
wsgi_server = NonBindingServer(
logged_app, _sock=socket.fromfd(3, socket.AF_UNIX, socket.SOCK_STREAM)
)
Expand Down

0 comments on commit 1d43118

Please sign in to comment.