mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Catching error when PIDfile cannot be deleted
Usually the PIDfile is locate in /run. If Salt is not started with root permissions, it is not able to delete the PIDfile in /run. It should be safe to just log and ignore this error, since Salt overwrites the PIDfile on the next start.
This commit is contained in:
parent
0c986f5eba
commit
daf4948b3d
1 changed files with 8 additions and 1 deletions
|
@ -882,7 +882,14 @@ class DaemonMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
# We've loaded and merged options into the configuration, it's safe
|
||||
# to query about the pidfile
|
||||
if self.check_pidfile():
|
||||
os.unlink(self.config['pidfile'])
|
||||
try:
|
||||
os.unlink(self.config['pidfile'])
|
||||
except OSError as err:
|
||||
self.info(
|
||||
'PIDfile could not be deleted: {0}'.format(
|
||||
self.config['pidfile'], traceback.format_exc(err)
|
||||
)
|
||||
)
|
||||
|
||||
def set_pidfile(self):
|
||||
from salt.utils.process import set_pidfile
|
||||
|
|
Loading…
Add table
Reference in a new issue