Merge "Plumb zookeeper config settings into zuul-scheduler" into feature/zuulv3

This commit is contained in:
Jenkins 2017-02-21 16:27:18 +00:00 committed by Gerrit Code Review
commit 572a52c82a
2 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,7 @@ log_config=/etc/zuul/logging.conf
pidfile=/var/run/zuul/zuul.pid
state_dir=/var/lib/zuul
status_url=https://jenkins.example.com/zuul/status
zookeeper_hosts=127.0.0.1:2181
[merger]
git_dir=/var/lib/zuul/git

View File

@ -153,6 +153,7 @@ class Scheduler(zuul.cmd.ZuulApp):
import zuul.lib.swift
import zuul.webapp
import zuul.rpclistener
import zuul.zk
signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
if (self.config.has_option('gearman_server', 'start') and
@ -171,6 +172,14 @@ class Scheduler(zuul.cmd.ZuulApp):
merger = zuul.merger.client.MergeClient(self.config, self.sched)
nodepool = zuul.nodepool.Nodepool(self.sched)
zookeeper = zuul.zk.ZooKeeper()
if self.config.has_option('zuul', 'zookeeper_hosts'):
zookeeper_hosts = self.config.get('zuul', 'zookeeper_hosts')
else:
zookeeper_hosts = '127.0.0.1:2181'
zookeeper.connect(zookeeper_hosts)
if self.config.has_option('zuul', 'status_expiry'):
cache_expiry = self.config.getint('zuul', 'status_expiry')
else:
@ -195,6 +204,7 @@ class Scheduler(zuul.cmd.ZuulApp):
self.sched.setLauncher(gearman)
self.sched.setMerger(merger)
self.sched.setNodepool(nodepool)
self.sched.setZooKeeper(zookeeper)
self.log.info('Starting scheduler')
try: