From 687962289466a27193ff9e00eb94083a3a775a5f Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 7 Dec 2016 17:51:07 -0800 Subject: [PATCH] create-node: avoid introducer.furl=None Previously, "tahoe create-node" without an --introducer= argument would result in the literal string "None" being written into tahoe.cfg: [client] introducer.furl = None We were using config.get("introducer",""), but that didn't suffice because the key was actually present: it just had a value of None, which then got stringified into "None" when writing out tahoe.cfg. This briefly caused test/cli/test_create to fail, as the startup code tried to parse "None" as a FURL. This only happened against a development version of Foolscap which accidentally became sensitive to unparseable FURLs in started Reconnectors. I fixed that in the final foolscap-0.12.5 release, so we shouldn't hit this bug, but I wanted to fix it properly in the tahoe-side source. --- src/allmydata/client.py | 4 ++++ src/allmydata/scripts/create_node.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/allmydata/client.py b/src/allmydata/client.py index e03e9ca47..d9c77b7e3 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -256,6 +256,10 @@ class Client(node.Node, pollmixin.PollMixin): # read furl from tahoe.cfg tahoe_cfg_introducer_furl = self.get_config("client", "introducer.furl", None) + if tahoe_cfg_introducer_furl == "None": + raise ValueError("tahoe.cfg has invalid 'introducer.furl = None':" + " to disable it, use 'introducer.furl ='" + " or omit the key entirely") if tahoe_cfg_introducer_furl: introducers[u'default'] = {'furl':tahoe_cfg_introducer_furl} diff --git a/src/allmydata/scripts/create_node.py b/src/allmydata/scripts/create_node.py index 41002deb7..5f1166df3 100644 --- a/src/allmydata/scripts/create_node.py +++ b/src/allmydata/scripts/create_node.py @@ -279,7 +279,8 @@ def write_node_config(c, config): def write_client_config(c, config): c.write("[client]\n") c.write("# Which services should this client connect to?\n") - c.write("introducer.furl = %s\n" % config.get("introducer", "")) + introducer = config.get("introducer", None) or "" + c.write("introducer.furl = %s\n" % introducer) c.write("helper.furl =\n") c.write("#stats_gatherer.furl =\n") c.write("\n")