mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 14:52:26 +00:00
rename "dir-uri" to "dir-cap"
This commit is contained in:
parent
f2e9965c3c
commit
4223f7216d
@ -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 ==
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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]
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user