mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #16163 from gtmanfred/2014.7
move systemd notify to process
This commit is contained in:
commit
e26b940642
@ -53,12 +53,6 @@ try:
|
||||
except ImportError:
|
||||
HAS_HALITE = False
|
||||
|
||||
try:
|
||||
import systemd.daemon
|
||||
HAS_PYTHON_SYSTEMD = True
|
||||
except ImportError:
|
||||
HAS_PYTHON_SYSTEMD = False
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -490,13 +484,6 @@ class ReqServer(object):
|
||||
|
||||
self.workers.bind(self.w_uri)
|
||||
|
||||
try:
|
||||
if HAS_PYTHON_SYSTEMD and systemd.daemon.booted():
|
||||
systemd.daemon.notify('READY=1')
|
||||
except SystemError:
|
||||
# Daemon wasn't started by systemd
|
||||
pass
|
||||
|
||||
while True:
|
||||
try:
|
||||
zmq.device(zmq.QUEUE, self.clients, self.workers)
|
||||
|
@ -20,6 +20,12 @@ try:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import systemd.daemon
|
||||
HAS_PYTHON_SYSTEMD = True
|
||||
except ImportError:
|
||||
HAS_PYTHON_SYSTEMD = False
|
||||
|
||||
|
||||
def set_pidfile(pidfile, user):
|
||||
'''
|
||||
@ -178,6 +184,13 @@ class ProcessManager(object):
|
||||
# make sure to kill the subprocesses if the parent is killed
|
||||
signal.signal(signal.SIGTERM, self.kill_children)
|
||||
|
||||
try:
|
||||
if HAS_PYTHON_SYSTEMD and systemd.daemon.booted():
|
||||
systemd.daemon.notify('READY=1')
|
||||
except SystemError:
|
||||
# Daemon wasn't started by systemd
|
||||
pass
|
||||
|
||||
while True:
|
||||
try:
|
||||
pid, exit_status = os.wait()
|
||||
|
Loading…
Reference in New Issue
Block a user