Don't fork in try with critical finally logic.

Fork executes finally section triple times.
This commit is contained in:
Dmitry Kuzmenko 2016-02-26 17:06:19 +03:00 committed by Dmitry
parent 877bc25381
commit a50b33d96a

View file

@ -642,9 +642,11 @@ class Schedule(object):
except OSError:
log.info('Unable to remove file: {0}.'.format(fn_))
try:
salt.utils.daemonize_if(self.opts)
# Don't *BEFORE* to go into try to don't let it triple execute the finally section.
salt.utils.daemonize_if(self.opts)
# TODO: Make it readable! Splt to funcs, remove nested try-except-finally sections.
try:
ret['pid'] = os.getpid()
if 'jid_include' not in data or data['jid_include']: