]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Fix the bug that prevents an introducer from starting when introducer.furl already...
authordavid-sarah <david-sarah@jacaranda.org>
Wed, 3 Aug 2011 01:32:12 +0000 (18:32 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Wed, 3 Aug 2011 01:32:12 +0000 (18:32 -0700)
src/allmydata/client.py
src/allmydata/introducer/server.py
src/allmydata/node.py

index fb7e0c890b4a51983d6707b6b6df225c709b363b..ac3b2e00d17dcf6000474ddd71eb4aceefbed82d 100644 (file)
@@ -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,
index 117fcb5538112abb839a09458150df4167e53e38..dd042a4f0fe20993f220719827fb3739a41e2ca3 100644 (file)
@@ -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)
index fc7933c0ed0fe7eb2889255eddf59cb1530e8947..a671d1dfbedf7776b1b88fc41e3f5d85b1884514 100644 (file)
@@ -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)