fix back compat issues with python modules

When using python-daemon 1.6, the interface has changed in an
uncompatible way. Clark pointed me to Gerritbot which solves that issue
with a simple try / catch block implemented with:

b2be72e69d

So this patch is merely a copy/paste from David "davido" Ostrovsky with
a small workaround for pyflakes issue #13 (we have to prented we are
using the variable holding the module).

Change-Id: Iffdf7fca067734fa9c09b5bddfb13f122e6251a7
Reviewed-on: https://review.openstack.org/13524
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Antoine Musso 2012-09-22 21:37:45 +02:00 committed by Jenkins
parent a969e82030
commit 80925f5131
1 changed files with 10 additions and 2 deletions

View File

@ -16,7 +16,15 @@
import argparse
import ConfigParser
import daemon
import daemon.pidlockfile
try:
import daemon.pidlockfile as pid_file_module
pid_file_module # workaround for pyflakes issue #13
except:
# as of python-daemon 1.6 it doesn't bundle pidlockfile anymore
# instead it depends on lockfile-0.9.1 which uses pidfile.
import daemon.pidfile as pid_file_module
import logging.config
import os
import signal
@ -120,7 +128,7 @@ if __name__ == '__main__':
pid_fn = os.path.expanduser(server.config.get('zuul', 'pidfile'))
else:
pid_fn = '/var/run/zuul/zuul.pid'
pid = daemon.pidlockfile.TimeoutPIDLockFile(pid_fn, 10)
pid = pid_file_module.TimeoutPIDLockFile(pid_fn, 10)
if server.args.nodaemon:
server.setup_logging()