From: Brian Warner Date: Thu, 18 Apr 2013 07:06:55 +0000 (-0700) Subject: client.py: create node key even when storage is disabled. Closes #1945. X-Git-Tag: allmydata-tahoe-1.10b1~1 X-Git-Url: https://git.rkrishnan.org/pf/content//%22?a=commitdiff_plain;h=b989555d96e96b6f9b0664cf63afeafef4a8b83d;p=tahoe-lafs%2Ftahoe-lafs.git client.py: create node key even when storage is disabled. Closes #1945. Thanks to Leif for the catch! --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index 4f4745cc..217a7b47 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -134,6 +134,7 @@ class Client(node.Node, pollmixin.PollMixin): self.init_introducer_client() self.init_stats_provider() self.init_secrets() + self.init_node_key() self.init_storage() self.init_control() self.helper = None @@ -209,7 +210,7 @@ class Client(node.Node, pollmixin.PollMixin): self.convergence = base32.a2b(convergence_s) self._secret_holder = SecretHolder(lease_secret, self.convergence) - def _maybe_create_node_key(self): + def init_node_key(self): # we only create the key once. On all subsequent runs, we re-use the # existing key def _make_key(): @@ -255,8 +256,6 @@ class Client(node.Node, pollmixin.PollMixin): return readonly = self.get_config("storage", "readonly", False, boolean=True) - self._maybe_create_node_key() - storedir = os.path.join(self.basedir, self.STOREDIR) data = self.get_config("storage", "reserved_space", None) diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index 61d08603..796971b2 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -78,6 +78,22 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase): cancel_secret = c.get_cancel_secret() self.failUnless(base32.b2a(cancel_secret)) + def test_nodekey_yes_storage(self): + basedir = "test_client.Basic.test_nodekey_yes_storage" + os.mkdir(basedir) + fileutil.write(os.path.join(basedir, "tahoe.cfg"), + BASECONFIG) + c = client.Client(basedir) + self.failUnless(c.get_long_nodeid().startswith("v0-")) + + def test_nodekey_no_storage(self): + basedir = "test_client.Basic.test_nodekey_no_storage" + os.mkdir(basedir) + fileutil.write(os.path.join(basedir, "tahoe.cfg"), + BASECONFIG + "[storage]\n" + "enabled = false\n") + c = client.Client(basedir) + self.failUnless(c.get_long_nodeid().startswith("v0-")) + def test_reserved_1(self): basedir = "client.Basic.test_reserved_1" os.mkdir(basedir)