From 4223f7216d347614a23424e5c1af9372c35790cd Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Tue, 8 Jan 2008 10:41:27 -0700 Subject: [PATCH] rename "dir-uri" to "dir-cap" --- docs/configuration.txt | 4 ++-- src/allmydata/scripts/cli.py | 28 ++++++++++++++-------------- src/allmydata/scripts/tahoe_get.py | 4 ++-- src/allmydata/scripts/tahoe_ls.py | 4 ++-- src/allmydata/scripts/tahoe_put.py | 4 ++-- src/allmydata/scripts/tahoe_rm.py | 4 ++-- src/allmydata/test/test_cli.py | 16 ++++++++-------- src/allmydata/test/test_system.py | 4 ++-- 8 files changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/configuration.txt b/docs/configuration.txt index 09ff5d33..001bfe70 100644 --- a/docs/configuration.txt +++ b/docs/configuration.txt @@ -79,8 +79,8 @@ directory on a separate size-limited filesystem, and/or use per-user OS/filesystem quotas. root_dir.cap (optional): The command-line tools will read a directory cap out of -this file and use it, if you don't specify a '--dir-uri' option or if you -specify '--dir-uri=root'. +this file and use it, if you don't specify a '--dir-cap' option or if you +specify '--dir-cap=root'. == Node State == diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index c5c4ef79..0e063377 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -17,7 +17,7 @@ class VDriveOptions(BaseOptions, usage.Options): ["node-url", "u", None, "URL of the tahoe node to use, a URL like \"http://127.0.0.1:8123\". " "This overrides the URL found in the --node-directory ."], - ["dir-uri", "r", "root", + ["dir-cap", "r", "root", "Which dirnode URI should be used as a root directory. The " "string 'root' is special, and means we should use the " "directory found in the 'root_dir.cap' file in the 'private' " @@ -40,18 +40,18 @@ class VDriveOptions(BaseOptions, usage.Options): self['node-url'] = open(node_url_file, "r").read().strip() rootdircap = None - if self['dir-uri'] == 'root': + if self['dir-cap'] == 'root': uri_file = os.path.join(self['node-directory'], 'private', "root_dir.cap") try: rootdircap = open(uri_file, "r").read().strip() except EnvironmentError, le: raise usage.UsageError("\n" - "If --dir-uri is absent or is 'root', then the node directory's 'private'\n" + "If --dir-cap is absent or is 'root', then the node directory's 'private'\n" "subdirectory is required to contain a file named 'root_dir.cap' which must\n" "contain a dir cap, but when we tried to open that file we got:\n" "'%s'." % (le,)) else: - rootdircap = self['dir-uri'] + rootdircap = self['dir-cap'] from allmydata import uri try: parsed = uri.NewDirectoryURI.init_from_human_encoding(rootdircap) @@ -59,15 +59,15 @@ class VDriveOptions(BaseOptions, usage.Options): try: parsed = uri.ReadonlyNewDirectoryURI.init_from_human_encoding(rootdircap) except: - if self['dir-uri'] == 'root': + if self['dir-cap'] == 'root': raise usage.UsageError("\n" - "If --dir-uri is absent or is 'root', then the node directory's 'private'\n" + "If --dir-cap is absent or is 'root', then the node directory's 'private'\n" "subdirectory's 'root_dir.cap' is required to contain a dir cap, but we found\n" "'%s'." % (rootdircap,)) else: - raise usage.UsageError("--dir-uri must be a dir cap (or \"root\"), but we got '%s'." % (self['dir-uri'],)) + raise usage.UsageError("--dir-cap must be a dir cap (or \"root\"), but we got '%s'." % (self['dir-cap'],)) - self['dir-uri'] = parsed.to_string() + self['dir-cap'] = parsed.to_string() class ListOptions(VDriveOptions): def parseArgs(self, vdrive_pathname=""): @@ -132,7 +132,7 @@ subCommands = [ def list(config, stdout, stderr): from allmydata.scripts import tahoe_ls rc = tahoe_ls.list(config['node-url'], - config['dir-uri'], + config['dir-cap'], config['vdrive_pathname'], stdout, stderr) return rc @@ -142,7 +142,7 @@ def get(config, stdout, stderr): vdrive_filename = config['vdrive_filename'] local_filename = config['local_filename'] rc = tahoe_get.get(config['node-url'], - config['dir-uri'], + config['dir-cap'], vdrive_filename, local_filename, stdout, stderr) @@ -166,7 +166,7 @@ def put(config, stdout, stderr): else: verbosity = 2 rc = tahoe_put.put(config['node-url'], - config['dir-uri'], + config['dir-cap'], local_filename, vdrive_filename, verbosity, @@ -181,7 +181,7 @@ def rm(config, stdout, stderr): else: verbosity = 2 rc = tahoe_rm.rm(config['node-url'], - config['dir-uri'], + config['dir-cap'], vdrive_pathname, verbosity, stdout, stderr) @@ -192,7 +192,7 @@ def mv(config, stdout, stderr): frompath = config['from'] topath = config['to'] rc = tahoe_mv.mv(config['node-url'], - config['dir-uri'], + config['dir-cap'], frompath, topath, stdout, stderr) @@ -203,7 +203,7 @@ def webopen(config, stdout, stderr): nodeurl = config['node-url'] if nodeurl[-1] != "/": nodeurl += "/" - url = nodeurl + "uri/%s/" % urllib.quote(config['dir-uri']) + url = nodeurl + "uri/%s/" % urllib.quote(config['dir-cap']) if config['vdrive_pathname']: url += urllib.quote(config['vdrive_pathname']) webbrowser.open(url) diff --git a/src/allmydata/scripts/tahoe_get.py b/src/allmydata/scripts/tahoe_get.py index 9b475695..8c4b60bf 100644 --- a/src/allmydata/scripts/tahoe_get.py +++ b/src/allmydata/scripts/tahoe_get.py @@ -31,7 +31,7 @@ def main(): import optparse, re parser = optparse.OptionParser() parser.add_option("-u", "--nodeurl", dest="nodeurl") - parser.add_option("-r", "--dir-uri", dest="rooturi") + parser.add_option("-r", "--dir-cap", dest="rooturi") (options, args) = parser.parse_args() @@ -40,7 +40,7 @@ def main(): raise ValueError("--node-url is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (options.nodeurl,)) if not options.rooturi: - raise ValueError("must provide --dir-uri") + raise ValueError("must provide --dir-cap") vdrive_fname = args[0] local_file = None diff --git a/src/allmydata/scripts/tahoe_ls.py b/src/allmydata/scripts/tahoe_ls.py index ad9fbcc6..025e14f4 100644 --- a/src/allmydata/scripts/tahoe_ls.py +++ b/src/allmydata/scripts/tahoe_ls.py @@ -34,7 +34,7 @@ def main(): import optparse, re parser = optparse.OptionParser() parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--dir-uri", dest="rooturi") + parser.add_option("-r", "--dir-cap", dest="rooturi") (options, args) = parser.parse_args() @@ -43,7 +43,7 @@ def main(): raise ValueError("--node-url is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (options.nodeurl,)) if not options.rooturi: - raise ValueError("must provide --dir-uri") + raise ValueError("must provide --dir-cap") vdrive_pathname = "" if args: diff --git a/src/allmydata/scripts/tahoe_put.py b/src/allmydata/scripts/tahoe_put.py index f27e0fcf..c81ec9c2 100644 --- a/src/allmydata/scripts/tahoe_put.py +++ b/src/allmydata/scripts/tahoe_put.py @@ -31,7 +31,7 @@ def main(): import optparse, re parser = optparse.OptionParser() parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--dir-uri", dest="rooturi") + parser.add_option("-r", "--dir-cap", dest="rooturi") (options, args) = parser.parse_args() @@ -40,7 +40,7 @@ def main(): raise ValueError("--node-url is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (options.nodeurl,)) if not options.rooturi: - raise ValueError("must provide --dir-uri") + raise ValueError("must provide --dir-cap") local_file = args[0] vdrive_fname = None diff --git a/src/allmydata/scripts/tahoe_rm.py b/src/allmydata/scripts/tahoe_rm.py index 32e95316..d9106f3a 100644 --- a/src/allmydata/scripts/tahoe_rm.py +++ b/src/allmydata/scripts/tahoe_rm.py @@ -29,7 +29,7 @@ def main(): import optparse, re parser = optparse.OptionParser() parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--dir-uri", dest="rooturi") + parser.add_option("-r", "--dir-cap", dest="rooturi") (options, args) = parser.parse_args() @@ -38,7 +38,7 @@ def main(): raise ValueError("--node-url is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (options.nodeurl,)) if not options.rooturi: - raise ValueError("must provide --dir-uri") + raise ValueError("must provide --dir-cap") vdrive_pathname = args[0] diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index ed355b4d..a1e19b72 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -24,21 +24,21 @@ class CLI(unittest.TestCase): o = cli.ListOptions() o.parseOptions(["--node-directory", "cli/test_options"]) self.failUnlessEqual(o['node-url'], "http://localhost:8080/") - self.failUnlessEqual(o['dir-uri'], private_uri) + self.failUnlessEqual(o['dir-cap'], private_uri) self.failUnlessEqual(o['vdrive_pathname'], "") o = cli.ListOptions() o.parseOptions(["--node-directory", "cli/test_options", "--node-url", "http://example.org:8111/"]) self.failUnlessEqual(o['node-url'], "http://example.org:8111/") - self.failUnlessEqual(o['dir-uri'], private_uri) + self.failUnlessEqual(o['dir-cap'], private_uri) self.failUnlessEqual(o['vdrive_pathname'], "") o = cli.ListOptions() o.parseOptions(["--node-directory", "cli/test_options", - "--dir-uri", "root"]) + "--dir-cap", "root"]) self.failUnlessEqual(o['node-url'], "http://localhost:8080/") - self.failUnlessEqual(o['dir-uri'], private_uri) + self.failUnlessEqual(o['dir-cap'], private_uri) self.failUnlessEqual(o['vdrive_pathname'], "") o = cli.ListOptions() @@ -51,14 +51,14 @@ class CLI(unittest.TestCase): fingerprint="\x11"*32) other_uri = uri.NewDirectoryURI(other_filenode_uri).to_string() o.parseOptions(["--node-directory", "cli/test_options", - "--dir-uri", other_uri]) + "--dir-cap", other_uri]) self.failUnlessEqual(o['node-url'], "http://localhost:8080/") - self.failUnlessEqual(o['dir-uri'], other_uri) + self.failUnlessEqual(o['dir-cap'], other_uri) self.failUnlessEqual(o['vdrive_pathname'], "") o = cli.ListOptions() o.parseOptions(["--node-directory", "cli/test_options", - "--dir-uri", other_uri, "subdir"]) + "--dir-cap", other_uri, "subdir"]) self.failUnlessEqual(o['node-url'], "http://localhost:8080/") - self.failUnlessEqual(o['dir-uri'], other_uri) + self.failUnlessEqual(o['dir-cap'], other_uri) self.failUnlessEqual(o['vdrive_pathname'], "subdir") diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index e5faf4ee..96df405c 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -993,11 +993,11 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): nodeargs = [ "--node-url", self.webish_url, - "--dir-uri", private_uri, + "--dir-cap", private_uri, ] public_nodeargs = [ "--node-url", self.webish_url, - "--dir-uri", some_uri, + "--dir-cap", some_uri, ] TESTDATA = "I will not write the same thing over and over.\n" * 100 -- 2.45.2