Merge "Get persistence backend via kwargs instead of conf"

This commit is contained in:
Jenkins
2014-04-16 20:42:20 +00:00
committed by Gerrit Code Review
2 changed files with 8 additions and 7 deletions

View File

@@ -143,7 +143,7 @@ class ZookeeperJob(base_job.Job):
class ZookeeperJobBoard(jobboard.JobBoard):
def __init__(self, name, conf, client=None):
def __init__(self, name, conf, client=None, persistence=None):
super(ZookeeperJobBoard, self).__init__(name, conf)
if client is not None:
self._client = client
@@ -162,7 +162,7 @@ class ZookeeperJobBoard(jobboard.JobBoard):
# not currently the full logbook (later when a zookeeper backend
# appears we can likely optimize for that backend usage by directly
# reading from the path where the data is stored, if we want).
self._persistence = self._conf.get("persistence")
self._persistence = persistence
# Misc. internal details
self._known_jobs = {}
self._job_mutate = self._client.handler.rlock_object()

View File

@@ -44,11 +44,12 @@ def connect_close(*args):
a.close()
def create_board(**kwargs):
client = fake_client.FakeClient()
board = impl_zookeeper.ZookeeperJobBoard('test-board',
conf=dict(kwargs),
client=client)
def create_board(client=None, persistence=None):
if not client:
client = fake_client.FakeClient()
board = impl_zookeeper.ZookeeperJobBoard('test-board', {},
client=client,
persistence=persistence)
return (client, board)