Commit 021dc4cc authored by Antoine Catton's avatar Antoine Catton

Bugfix: stunnel recipe pass if stunnel didn't cleaned-up its pid file

parent 43df8058
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
############################################################################## ##############################################################################
import os import os
import signal import signal
import errno
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
...@@ -86,7 +87,13 @@ class Recipe(GenericBaseRecipe): ...@@ -86,7 +87,13 @@ class Recipe(GenericBaseRecipe):
with open(pid_file, 'r') as file_: with open(pid_file, 'r') as file_:
pid = file_.read().strip() pid = file_.read().strip()
# Reload configuration # Reload configuration
os.kill(int(pid, 10), signal.SIGHUP) try:
os.kill(int(pid, 10), signal.SIGHUP)
except OSError, e:
if e.errno == errno.ESRCH: # No such process
os.unlink(pid_file)
else:
raise e
if 'post-rotate-script' in self.options: if 'post-rotate-script' in self.options:
self.createPythonScript(self.options['post-rotate-script'], self.createPythonScript(self.options['post-rotate-script'],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment