From 80925f513125caf627758a5363bebb9782b30c57 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 22 Sep 2012 21:37:45 +0200 Subject: [PATCH] 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: https://github.com/openstack-ci/gerritbot/commit/b2be72e69d08c774989b2cc8c39748ed06ffb1bf 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 Reviewed-by: James E. Blair Approved: James E. Blair Tested-by: Jenkins --- zuul-server | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/zuul-server b/zuul-server index 0f89cd2672..3e06e06652 100755 --- a/zuul-server +++ b/zuul-server @@ -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()