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 <corvus@inaugust.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Clark Boylan 2013-05-17 10:07:19 -07:00 committed by Jenkins
parent 67e81cc7fa
commit ff66c84a94

View File

@ -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