Get the path manipulation into _Config too
This commit is contained in:
parent
bef5ccd0ca
commit
e0f69dcfcf
|
@ -465,17 +465,16 @@ def create_introducer_clients(config, main_tub, _introducer_factory=None):
|
|||
|
||||
introducers = config.get_introducer_configuration()
|
||||
|
||||
for petname, introducer_furl in introducers.items():
|
||||
introducer_cache_filepath = FilePath(config.get_private_path("introducer_{}_cache.yaml".format(petname)))
|
||||
for petname, (furl, cache_path) in introducers.items():
|
||||
ic = _introducer_factory(
|
||||
main_tub,
|
||||
introducer_furl.encode("ascii"),
|
||||
furl.encode("ascii"),
|
||||
config.nickname,
|
||||
str(allmydata.__full_version__),
|
||||
str(_Client.OLDEST_SUPPORTED_VERSION),
|
||||
list(node.get_app_versions()),
|
||||
partial(_sequencer, config),
|
||||
introducer_cache_filepath,
|
||||
cache_path,
|
||||
)
|
||||
introducer_clients.append(ic)
|
||||
return introducer_clients
|
||||
|
|
|
@ -438,12 +438,17 @@ class _Config(object):
|
|||
"""
|
||||
Get configuration for introducers.
|
||||
|
||||
:return {unicode: unicode}: A mapping from introducer petname to the
|
||||
introducer's fURL.
|
||||
:return {unicode: (unicode, FilePath)}: A mapping from introducer
|
||||
petname to a tuple of the introducer's fURL and local cache path.
|
||||
"""
|
||||
introducers_yaml_filename = self.get_private_path("introducers.yaml")
|
||||
introducers_filepath = FilePath(introducers_yaml_filename)
|
||||
|
||||
def get_cache_filepath(petname):
|
||||
return FilePath(
|
||||
self.get_private_path("introducer_{}_cache.yaml".format(petname)),
|
||||
)
|
||||
|
||||
try:
|
||||
with introducers_filepath.open() as f:
|
||||
introducers_yaml = safe_load(f)
|
||||
|
@ -491,7 +496,11 @@ class _Config(object):
|
|||
)
|
||||
introducers['default'] = tahoe_cfg_introducer_furl
|
||||
|
||||
return introducers
|
||||
return {
|
||||
petname: (furl, get_cache_filepath(petname))
|
||||
for (petname, furl)
|
||||
in introducers.items()
|
||||
}
|
||||
|
||||
|
||||
def create_tub_options(config):
|
||||
|
|
Loading…
Reference in New Issue