From e62692dc8fb4fcfd007e54a58f5685fd57c17d42 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Fri, 5 Oct 2012 12:28:10 -0400 Subject: [PATCH] Fix PID file for Libra tools. Using the `lockfile` module didn't produce a PID file that contained the process PID number, just an empty .lck file. Using the TimeoutPIDLockFile distributed with the `daemon` module gives us what we expect: a .pid file with the PID number as the contents. --- libra/mgm/mgm.py | 4 ++-- libra/worker/worker.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libra/mgm/mgm.py b/libra/mgm/mgm.py index eb4a8d4f..fc58981e 100644 --- a/libra/mgm/mgm.py +++ b/libra/mgm/mgm.py @@ -14,8 +14,8 @@ # under the License. import daemon +import daemon.pidfile import grp -import lockfile import pwd import signal import sys @@ -68,7 +68,7 @@ def main(): context = daemon.DaemonContext( working_directory='/etc/haproxy', umask=0o022, - pidfile=lockfile.FileLock(args.pid), + pidfile=daemon.pidfile.TimeoutPIDLockFile(args.pid), files_preserve=[logger.handlers[0].stream] ) if args.user: diff --git a/libra/worker/worker.py b/libra/worker/worker.py index 188bd508..b63a6ac8 100644 --- a/libra/worker/worker.py +++ b/libra/worker/worker.py @@ -13,10 +13,10 @@ # under the License. import daemon +import daemon.pidfile import gearman.errors import grp import json -import lockfile import pwd import socket from time import sleep @@ -195,7 +195,7 @@ def main(): context = daemon.DaemonContext( working_directory='/etc/haproxy', umask=0o022, - pidfile=lockfile.FileLock(args.pid), + pidfile=daemon.pidfile.TimeoutPIDLockFile(args.pid), files_preserve=[logger.handlers[0].stream] ) if args.user: