de-Service-ify Helper, pass in storage_broker and secret_holder directly.

This makes it more obvious that the Helper currently generates leases with
the Helper's own secrets, rather than getting values from the client, which
is arguably a bug that will likely be resolved with the Accounting project.
This commit is contained in:
Brian Warner
2009-08-15 13:17:37 -07:00
parent 4a4a4f9520
commit 5283d4c19e
5 changed files with 30 additions and 36 deletions

View File

@ -111,6 +111,7 @@ class Client(node.Node, pollmixin.PollMixin):
self.init_lease_secret()
self.init_storage()
self.init_control()
self.helper = None
if self.get_config("helper", "enabled", False, boolean=True):
self.init_helper()
self._key_generator = KeyGenerator()
@ -345,9 +346,9 @@ class Client(node.Node, pollmixin.PollMixin):
def init_helper(self):
d = self.when_tub_ready()
def _publish(self):
h = Helper(os.path.join(self.basedir, "helper"),
self.stats_provider, self.history)
h.setServiceParent(self)
self.helper = Helper(os.path.join(self.basedir, "helper"),
self.storage_broker, self._secret_holder,
self.stats_provider, self.history)
# TODO: this is confusing. BASEDIR/private/helper.furl is created
# by the helper. BASEDIR/helper.furl is consumed by the client
# who wants to use the helper. I like having the filename be the
@ -355,7 +356,7 @@ class Client(node.Node, pollmixin.PollMixin):
# between config inputs and generated outputs is hard to see.
helper_furlfile = os.path.join(self.basedir,
"private", "helper.furl")
self.tub.registerReference(h, furlFile=helper_furlfile)
self.tub.registerReference(self.helper, furlFile=helper_furlfile)
d.addCallback(_publish)
d.addErrback(log.err, facility="tahoe.init",
level=log.BAD, umid="K0mW5w")