Get persistence backend via kwargs instead of conf

The persistence backend that the zookeeper backend uses to
load logbooks when they appear should come in via a kwarg
instead of coming in via conf (since it's not configuration).

Change-Id: I300d7681e5884a989549c8b84d29f04e9ea3d060
This commit is contained in:
Joshua Harlow 2014-04-08 23:02:20 -07:00
parent 6f5896c8bd
commit 3fd758d317
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)