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,
NODETYPE = "unknown NODETYPE"
PORTNUMFILE = None
CERTFILE = "node.pem"
+ GENERATED_FILES = []
def __init__(self, basedir=u"."):
service.MultiService.__init__(self)
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")
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()
'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)