get rid of 'add_service' (just an alias to setServiceParent anyway)

This commit is contained in:
meejah 2018-01-31 13:03:05 -07:00
parent ea99915af6
commit 08e0c3b7e2
5 changed files with 23 additions and 26 deletions

View File

@ -433,7 +433,7 @@ class _Client(node.Node, pollmixin.PollMixin):
def init_stats_provider(self):
gatherer_furl = self.config.get_config("client", "stats_gatherer.furl", None)
self.stats_provider = StatsProvider(self, gatherer_furl)
self.add_service(self.stats_provider)
self.stats_provider.setServiceParent(self)
self.stats_provider.register_producer(self)
def get_stats(self):
@ -545,7 +545,7 @@ class _Client(node.Node, pollmixin.PollMixin):
expiration_override_lease_duration=o_l_d,
expiration_cutoff_date=cutoff_date,
expiration_sharetypes=expiration_sharetypes)
self.add_service(ss)
ss.setServiceParent(self)
furl_file = self.config.get_private_path("storage.furl").encode(get_filesystem_encoding())
furl = self.tub.registerReference(ss, furlFile=furl_file)
@ -571,8 +571,12 @@ class _Client(node.Node, pollmixin.PollMixin):
self.history = History(self.stats_provider)
self.terminator = Terminator()
self.terminator.setServiceParent(self)
self.add_service(Uploader(helper_furl, self.stats_provider,
self.history))
uploader = Uploader(
helper_furl,
self.stats_provider,
self.history,
)
uploader.setServiceParent(self)
self.init_blacklist()
self.init_nodemaker()
@ -670,7 +674,7 @@ class _Client(node.Node, pollmixin.PollMixin):
staticdir_config = self.config.get_config("node", "web.static", "public_html").decode("utf-8")
staticdir = self.config.get_config_path(staticdir_config)
ws = WebishServer(self, webport, nodeurl_path, staticdir)
self.add_service(ws)
ws.setServiceParent(self)
def init_ftp_server(self):
if self.config.get_config("ftpd", "enabled", False, boolean=True):

View File

@ -95,7 +95,7 @@ class _IntroducerNode(node.Node):
raise ValueError("config error: we are Introducer, but tub "
"is not listening ('tub.port=' is empty)")
introducerservice = IntroducerService()
self.add_service(introducerservice)
introducerservice.setServiceParent(self)
old_public_fn = self.config.get_config_path(u"introducer.furl")
private_fn = self.config.get_private_path(u"introducer.furl")
@ -125,7 +125,7 @@ class _IntroducerNode(node.Node):
config_staticdir = self.get_config("node", "web.static", "public_html").decode('utf-8')
staticdir = self.config.get_config_path(config_staticdir)
ws = IntroducerWebishServer(self, webport, nodeurl_path, staticdir)
self.add_service(ws)
ws.setServiceParent(self)
@implementer(RIIntroducerPublisherAndSubscriberService_v2)
class IntroducerService(service.MultiService, Referenceable):

View File

@ -788,7 +788,3 @@ class Node(service.MultiService):
def log(self, *args, **kwargs):
return log.msg(*args, **kwargs)
def add_service(self, s):
s.setServiceParent(self)
return s

View File

@ -163,15 +163,11 @@ class SystemFramework(pollmixin.PollMixin):
d.addCallback(lambda res: passthrough)
return d
def add_service(self, s):
s.setServiceParent(self.sparent)
return s
def make_introducer(self):
iv_basedir = os.path.join(self.testdir, "introducer")
os.mkdir(iv_basedir)
iv = introducer.IntroducerNode(basedir=iv_basedir)
self.introducer = self.add_service(iv)
self.introducer = introducer.IntroducerNode(basedir=iv_basedir)
self.introducer.setServiceParent(self)
self.introducer_furl = self.introducer.introducer_url
def make_nodes(self):
@ -201,7 +197,8 @@ class SystemFramework(pollmixin.PollMixin):
# so our internal nodes can refuse requests
f.write("readonly = true\n")
f.close()
c = self.add_service(client.Client(basedir=nodedir))
c = client.Client(basedir=nodedir)
c.setServiceParent(self)
self.nodes.append(c)
# the peers will start running, eventually they will connect to each
# other and the introducer

View File

@ -557,8 +557,8 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
f = open(os.path.join(iv_dir, "private", "node.pem"), "w")
f.write(SYSTEM_TEST_CERTS[0])
f.close()
iv = yield create_introducer(basedir=iv_dir)
self.introducer = self.add_service(iv)
self.introducer = yield create_introducer(basedir=iv_dir)
self.introducer.setServiceParent(self)
self._get_introducer_web()
if use_stats_gatherer:
yield self._set_up_stats_gatherer(None)
@ -610,7 +610,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
fileutil.write(os.path.join(statsdir, "port"), port_endpoint)
self.stats_gatherer_svc = StatsGathererService(statsdir)
self.stats_gatherer = self.stats_gatherer_svc.stats_gatherer
self.add_service(self.stats_gatherer_svc)
self.stats_gatherer_svc.setServiceParent(self)
d = fireEventually()
sgf = os.path.join(statsdir, 'stats_gatherer.furl')
@ -633,8 +633,8 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
# start clients[0], wait for it's tub to be ready (at which point it
# will have registered the helper furl).
the_client = yield client.create_client(basedirs[0])
c = self.add_service(the_client)
c = yield client.create_client(basedirs[0])
c.setServiceParent(self)
self.clients.append(c)
c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
@ -651,8 +651,8 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
# this starts the rest of the clients
for i in range(1, self.numclients):
the_client = yield client.create_client(basedirs[i])
c = self.add_service(the_client)
c = yield client.create_client(basedirs[i])
c.setServiceParent(self)
self.clients.append(c)
c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
log.msg("STARTING")
@ -751,7 +751,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
new_c = yield client.create_client(self.getdir("client%d" % num))
self.clients[num] = new_c
new_c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
self.add_service(new_c)
new_c.setServiceParent(self)
d.addCallback(_stopped)
d.addCallback(lambda res: self.wait_for_connections())
def _maybe_get_webport(res):