Merge pull request #1375 from meejah/4110.storage-dir-option

4110: "--storage-dir" is an option
This commit is contained in:
meejah 2024-10-04 22:21:00 -06:00 committed by GitHub
commit 6d37fa6c9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,3 @@
Properly interpret "tahoe create --storage-dir" as an option.
Versions 1.19.0 and older interpreted "--storage-dir" as a "flag" and thus wouldn't work properly.

View File

@ -234,13 +234,15 @@ class CreateClientOptions(_CreateBaseOptions):
class CreateNodeOptions(CreateClientOptions):
optFlags = [
("no-storage", None, "Do not offer storage service to other nodes."),
("storage-dir", None, "Path where the storage will be placed."),
("helper", None, "Enable helper"),
] + TOR_FLAGS + I2P_FLAGS
synopsis = "[options] [NODEDIR]"
description = "Create a full Tahoe-LAFS node (client+server)."
optParameters = CreateClientOptions.optParameters + WHERE_OPTS + TOR_OPTS + I2P_OPTS
optParameters = [
("storage-dir", None, None, "Path where the storage will be placed."),
] + CreateClientOptions.optParameters + WHERE_OPTS + TOR_OPTS + I2P_OPTS
def parseArgs(self, basedir=None):
CreateClientOptions.parseArgs(self, basedir)

View File

@ -240,6 +240,13 @@ class Config(unittest.TestCase):
self.assertEqual(cfg.getboolean("node", "reveal-IP-address"), True)
self.assertFalse(cfg.has_section("connections"))
@defer.inlineCallbacks
def test_storage_dir(self):
basedir = self.mktemp()
rc, out, err = yield run_cli("create-node", "--storage-dir", "/tmp/storage", "--hostname=foo", basedir)
cfg = read_config(basedir)
self.assertEqual(cfg.get("storage", "storage_dir"), "/tmp/storage")
@defer.inlineCallbacks
def test_node_hide_ip(self):
basedir = self.mktemp()