split client, introducer READMEs

This commit is contained in:
meejah 2018-01-28 22:48:18 -07:00
parent 990f23d5c7
commit 79756c088e
3 changed files with 29 additions and 5 deletions

View File

@ -96,6 +96,15 @@ def _valid_config_sections():
})
return cfg
# this is put into README in new node-directories
CLIENT_README = """
This directory contains files which contain private data for the Tahoe node,
such as private keys. On Unix-like systems, the permissions on this directory
are set to disallow users other than its owner from reading the contents of
the files. See the 'configuration.rst' documentation file for details.
"""
def _make_secret():
return base32.b2a(os.urandom(hashutil.CRYPTO_VAL_SIZE)) + "\n"
@ -158,7 +167,10 @@ class Terminator(service.Service):
#@defer.inlineCallbacks
def create_client(basedir=u"."):
# load configuration
config = read_config(basedir, u"client.port", _valid_config_sections=_valid_config_sections)
config.write_private_config("README", CLIENT_README)
#defer.returnValue(
return _Client(
config,

View File

@ -11,6 +11,15 @@ from allmydata.introducer.interfaces import \
from allmydata.introducer.common import unsign_from_foolscap, \
SubscriberDescriptor, AnnouncementDescriptor
# this is put into README in new node-directories
INTRODUCER_README = """
This directory contains files which contain private data for the Tahoe node,
such as private keys. On Unix-like systems, the permissions on this directory
are set to disallow users other than its owner from reading the contents of
the files. See the 'configuration.rst' documentation file for details.
"""
def _valid_config_sections():
return node._common_config_sections()
@ -21,8 +30,13 @@ class FurlFileConflictError(Exception):
#@defer.inlineCallbacks
def create_introducer(basedir=u"."):
from allmydata.node import read_config
config = read_config(basedir, u"client.port", generated_files=["introducer.furl"])
config.validate(_valid_config_sections())
config = read_config(
basedir, u"client.port",
generated_files=["introducer.furl"],
_valid_config_secionts=_valid_config_sections,
)
config.write_private_config("README", INTRODUCER_README)
#defer.returnValue(
return _IntroducerNode(
config,

View File

@ -94,7 +94,7 @@ such as private keys. On Unix-like systems, the permissions on this directory
are set to disallow users other than its owner from reading the contents of
the files. See the 'configuration.rst' documentation file for details."""
class _None(object):
class _None(object): # used as a marker in get_config()
"""
This class is to be used as a marker in get_config()
"""
@ -375,8 +375,6 @@ class Node(service.MultiService):
is the current directory by default.
"""
service.MultiService.__init__(self)
with open(os.path.join(config._basedir, "private", "README"), "w") as f:
f.write(PRIV_README)
self.config = config
self.get_config = config.get_config # XXX stopgap