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 <mordred@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
diff --git a/zuul-server b/zuul-server
index 0f89cd2..3e06e06 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 @@
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()