From ff66c84a9499876723307f7867bdc862f7a87e68 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Fri, 17 May 2013 10:07:19 -0700 Subject: [PATCH] Write log pusher PID to PID file. The Jenkins log pusher daemon was not writing its PID to its PID file. This prevented init from properly stopping the service. Write the PID out to the file to fix this. Change-Id: I35352b6e241b54a439f3675d02344d901249dff1 Reviewed-on: https://review.openstack.org/29578 Reviewed-by: James E. Blair Approved: Clark Boylan Reviewed-by: Clark Boylan Tested-by: Jenkins --- modules/openstack_project/files/logstash/log-pusher.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/openstack_project/files/logstash/log-pusher.py b/modules/openstack_project/files/logstash/log-pusher.py index 4bff92bdc7..86c2a69f24 100644 --- a/modules/openstack_project/files/logstash/log-pusher.py +++ b/modules/openstack_project/files/logstash/log-pusher.py @@ -397,14 +397,16 @@ class DaemonContext(object): os.chdir(os.sep) # Lock pidfile. - self.pidfile = open(self.pidfile_path, 'w') + self.pidfile = open(self.pidfile_path, 'a') try: fcntl.lockf(self.pidfile, fcntl.LOCK_EX | fcntl.LOCK_NB) self.pidlocked = True except IOError: # another instance is running sys.exit(0) - # TODO(clarkb) write pid to pidfile + self.pidfile.truncate(0) + self.pidfile.write(str(os.getpid())) + self.pidfile.flush() def __exit__(self, exc_type, exc_value, traceback): # remove pidfile