mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 23:02:25 +00:00
Fix the bug that prevents an introducer from starting when introducer.furl already exists. Also remove some dead code that used to read old config files, and rename 'warn_about_old_config_files' to reflect that it's not a warning. refs #1385
This commit is contained in:
parent
e74387f4f1
commit
2d16a16ee3
@ -165,22 +165,6 @@ class Client(node.Node, pollmixin.PollMixin):
|
||||
if webport:
|
||||
self.init_web(webport) # strports string
|
||||
|
||||
def read_old_config_files(self):
|
||||
node.Node.read_old_config_files(self)
|
||||
copy = self._copy_config_from_file
|
||||
copy("introducer.furl", "client", "introducer.furl")
|
||||
copy("helper.furl", "client", "helper.furl")
|
||||
copy("key_generator.furl", "client", "key_generator.furl")
|
||||
copy("stats_gatherer.furl", "client", "stats_gatherer.furl")
|
||||
if os.path.exists(os.path.join(self.basedir, "no_storage")):
|
||||
self.set_config("storage", "enabled", "false")
|
||||
if os.path.exists(os.path.join(self.basedir, "readonly_storage")):
|
||||
self.set_config("storage", "readonly", "true")
|
||||
if os.path.exists(os.path.join(self.basedir, "debug_discard_storage")):
|
||||
self.set_config("storage", "debug_discard", "true")
|
||||
if os.path.exists(os.path.join(self.basedir, "run_helper")):
|
||||
self.set_config("helper", "enabled", "true")
|
||||
|
||||
def init_introducer_client(self):
|
||||
self.introducer_furl = self.get_config("client", "introducer.furl")
|
||||
ic = IntroducerClient(self.tub, self.introducer_furl,
|
||||
|
@ -13,6 +13,7 @@ from allmydata.introducer.interfaces import \
|
||||
class IntroducerNode(node.Node):
|
||||
PORTNUMFILE = "introducer.port"
|
||||
NODETYPE = "introducer"
|
||||
GENERATED_FILES = ['introducer.furl']
|
||||
|
||||
def __init__(self, basedir="."):
|
||||
node.Node.__init__(self, basedir)
|
||||
|
@ -53,6 +53,7 @@ class Node(service.MultiService):
|
||||
NODETYPE = "unknown NODETYPE"
|
||||
PORTNUMFILE = None
|
||||
CERTFILE = "node.pem"
|
||||
GENERATED_FILES = []
|
||||
|
||||
def __init__(self, basedir=u"."):
|
||||
service.MultiService.__init__(self)
|
||||
@ -62,7 +63,7 @@ class Node(service.MultiService):
|
||||
fileutil.make_dirs(os.path.join(self.basedir, "private"), 0700)
|
||||
open(os.path.join(self.basedir, "private", "README"), "w").write(PRIV_README)
|
||||
|
||||
# creates self.config, populates from distinct files if necessary
|
||||
# creates self.config
|
||||
self.read_config()
|
||||
nickname_utf8 = self.get_config("node", "nickname", "<unspecified>")
|
||||
self.nickname = nickname_utf8.decode("utf-8")
|
||||
@ -110,11 +111,11 @@ class Node(service.MultiService):
|
||||
assert self.config.get(section, option) == value
|
||||
|
||||
def read_config(self):
|
||||
self.warn_about_old_config_files()
|
||||
self.error_about_old_config_files()
|
||||
self.config = ConfigParser.SafeConfigParser()
|
||||
self.config.read([os.path.join(self.basedir, "tahoe.cfg")])
|
||||
|
||||
def warn_about_old_config_files(self):
|
||||
def error_about_old_config_files(self):
|
||||
""" If any old configuration files are detected, raise OldConfigError. """
|
||||
|
||||
oldfnames = set()
|
||||
@ -124,10 +125,11 @@ class Node(service.MultiService):
|
||||
'helper.furl', 'key_generator.furl', 'stats_gatherer.furl',
|
||||
'no_storage', 'readonly_storage', 'sizelimit',
|
||||
'debug_discard_storage', 'run_helper']:
|
||||
fullfname = os.path.join(self.basedir, name)
|
||||
if os.path.exists(fullfname):
|
||||
log.err("Found pre-Tahoe-LAFS-v1.3 configuration file: '%s'. See docs/historical/configuration.rst." % (fullfname,))
|
||||
oldfnames.add(fullfname)
|
||||
if name not in self.GENERATED_FILES:
|
||||
fullfname = os.path.join(self.basedir, name)
|
||||
if os.path.exists(fullfname):
|
||||
log.err("Found pre-Tahoe-LAFS-v1.3 configuration file: '%s'. See docs/historical/configuration.rst." % (fullfname,))
|
||||
oldfnames.add(fullfname)
|
||||
if oldfnames:
|
||||
raise OldConfigError(oldfnames)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user