mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Return int(-1) when pidfile contains invalid data
This commit is contained in:
parent
395b7f8fdc
commit
49b3e937da
2 changed files with 4 additions and 3 deletions
|
@ -35,6 +35,7 @@ import salt.utils.args
|
|||
import salt.utils.xdg
|
||||
import salt.utils.jid
|
||||
import salt.utils.files
|
||||
import salt.utils.win_functions
|
||||
from salt.utils import kinds
|
||||
from salt.defaults import DEFAULT_TARGET_DELIM
|
||||
from salt.utils.validate.path import is_writeable
|
||||
|
@ -1020,8 +1021,8 @@ class DaemonMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
if self.check_pidfile() and self.is_daemonized(pid) and not os.getppid() == pid:
|
||||
return True
|
||||
else:
|
||||
# We have no os.getppid() on Windows. Best effort.
|
||||
if self.check_pidfile() and self.is_daemonized(pid):
|
||||
# We have no os.getppid() on Windows. Use salt.utils.win_functions.get_parent_pid
|
||||
if self.check_pidfile() and self.is_daemonized(pid) and not salt.utils.win_functions.get_parent_pid() == pid:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ def get_pidfile(pidfile):
|
|||
pid = pdf.read().strip()
|
||||
return int(pid)
|
||||
except (OSError, IOError, TypeError, ValueError):
|
||||
return None
|
||||
return int(-1)
|
||||
|
||||
|
||||
def clean_proc(proc, wait_for_kill=10):
|
||||
|
|
Loading…
Add table
Reference in a new issue