From: Zooko O'Whielacronx Date: Fri, 4 Jan 2008 00:02:05 +0000 (-0700) Subject: remove automatic private dir X-Git-Tag: allmydata-tahoe-0.7.0~43 X-Git-Url: https://git.rkrishnan.org/schema.xhtml?a=commitdiff_plain;h=5995d11a3c320bd55d76eb2815832c6bfaacf475;p=tahoe-lafs%2Ftahoe-lafs.git remove automatic private dir * rename my_private_dir.cap to root_dir.cap * move it into the private subdir * change the cmdline argument "--root-uri=[private]" to "--dir-uri=[root]" --- diff --git a/docs/configuration.txt b/docs/configuration.txt index 675b4d9f..09ff5d33 100644 --- a/docs/configuration.txt +++ b/docs/configuration.txt @@ -78,16 +78,9 @@ possibly more reliable) limit, use a symlink to place the 'storage/' directory on a separate size-limited filesystem, and/or use per-user OS/filesystem quotas. -my_private_dir.cap (optional): When you create a new tahoe client, this -file is created with no contents (as an empty file). When the node starts -up, it will inspect this file. If the file doesn't exist then nothing will -be done. If the file exists, then the node will try to read the contents of -the file and parse the contents as a read-write URI to a mutable directory. -If the file exists but doesn't contain a well-formed read-write URI to a -mutable directory (which is the case if the file is empty), then the node -will create a new decentralized mutable directory and write its URI into this -file. The start.html page will contain a URL pointing to this directory if -it exists. +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'. == Node State == diff --git a/src/allmydata/client.py b/src/allmydata/client.py index bd9c363f..8c3b028e 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -16,13 +16,12 @@ from allmydata.download import Downloader from allmydata.checker import Checker from allmydata.control import ControlServer from allmydata.introducer import IntroducerClient -from allmydata.util import hashutil, idlib, testutil, observer +from allmydata.util import hashutil, idlib, testutil from allmydata.filenode import FileNode from allmydata.dirnode import NewDirectoryNode from allmydata.mutable import MutableFileNode from allmydata.interfaces import IURI, INewDirectoryURI, \ IReadonlyNewDirectoryURI, IFileURI, IMutableFileURI -from allmydata import uri class Client(node.Node, Referenceable, testutil.PollMixin): implements(RIClient) @@ -30,7 +29,6 @@ class Client(node.Node, Referenceable, testutil.PollMixin): STOREDIR = 'storage' NODETYPE = "client" SUICIDE_PREVENTION_HOTLINE_FILE = "suicide_prevention_hotline" - MY_PRIVATE_DIR_FILE = "my_private_dir.cap" # we're pretty narrow-minded right now OLDEST_SUPPORTED_VERSION = allmydata.__version__ @@ -46,9 +44,6 @@ class Client(node.Node, Referenceable, testutil.PollMixin): self.add_service(Uploader()) self.add_service(Downloader()) self.add_service(Checker()) - self.private_directory_uri = None - self._private_uri_observers = None - self._start_page_observers = None self.introducer_furl = self.get_config("introducer.furl", required=True) @@ -64,21 +59,6 @@ class Client(node.Node, Referenceable, testutil.PollMixin): if webport: self.init_web(webport) # strports string - def _init_start_page(self, privdiruri): - ws = self.getServiceNamed("webish") - startfile = os.path.join(self.basedir, "private", "start.html") - nodeurl_file = os.path.join(self.basedir, "node.url") - return ws.create_start_html(privdiruri, startfile, nodeurl_file) - - def init_start_page(self): - if not self._start_page_observers: - self._start_page_observers = observer.OneShotObserverList() - d = self.get_private_uri() - d.addCallback(self._init_start_page) - d.addCallback(self._start_page_observers.fire) - d.addErrback(log.err) - return self._start_page_observers.when_fired() - def init_lease_secret(self): def make_secret(): return idlib.b2a(os.urandom(hashutil.CRYPTO_VAL_SIZE)) + "\n" @@ -113,58 +93,6 @@ class Client(node.Node, Referenceable, testutil.PollMixin): if self.get_config("push_to_ourselves") is not None: self.push_to_ourselves = True - def _maybe_create_private_directory(self): - """ - If 'my_private_dir.cap' exists, then I try to read a mutable - directory URI from it. If it exists but doesn't contain a well-formed - read-write mutable directory URI, then I create a new mutable - directory and write its URI into that file. - """ - # TODO: change this to use Node.get_or_create_private_config(). That - # will probably require passing a validation function in, or - # something. - privdirfile = os.path.join(self.basedir, "private", - self.MY_PRIVATE_DIR_FILE) - if os.path.exists(privdirfile): - try: - theuri = open(privdirfile, "r").read().strip() - try: - uri.NewDirectoryURI.init_from_human_encoding(theuri) - except: - raise EnvironmentError("not a well-formed mutable directory uri") - except EnvironmentError, le: - d = self.when_tub_ready() - def _when_tub_ready(res): - return self.create_empty_dirnode(wait_for_numpeers=1) - d.addCallback(_when_tub_ready) - def _when_created(newdirnode): - log.msg("created new private directory: %s" % (newdirnode,)) - privdiruri = newdirnode.get_uri() - self.private_directory_uri = privdiruri - open(privdirfile, "w").write(privdiruri + "\n") - self._private_uri_observers.fire(privdiruri) - d.addCallback(_when_created) - d.addErrback(self._private_uri_observers.fire) - else: - self.private_directory_uri = theuri - log.msg("loaded private directory: %s" % (self.private_directory_uri,)) - self._private_uri_observers.fire(self.private_directory_uri) - else: - # If there is no such file then this is how the node is configured - # to not create a private directory. - self._private_uri_observers.fire(None) - - def get_private_uri(self): - """ - Eventually fires with the URI (as a string) to this client's private - directory, or with None if this client has been configured not to - create one. - """ - if self._private_uri_observers is None: - self._private_uri_observers = observer.OneShotObserverList() - self._maybe_create_private_directory() - return self._private_uri_observers.when_fired() - def init_web(self, webport): self.log("init_web(webport=%s)", args=(webport,)) @@ -173,7 +101,6 @@ class Client(node.Node, Referenceable, testutil.PollMixin): if self.get_config("webport_allow_localfile") is not None: ws.allow_local_access(True) self.add_service(ws) - self.init_start_page() def _check_hotline(self, hotline_file): if os.path.exists(hotline_file): diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index b14f08be..8c17e8aa 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -11,17 +11,17 @@ class VDriveOptions(BaseOptions, usage.Options): "Look here to find out which Tahoe node should be used for all " "operations. The directory should either contain a full Tahoe node, " "or a file named node.url which points to some other Tahoe node. " - "It should also contain a file named my_private_dir.cap which contains " + "It should also contain a file named root_dir.cap which contains " "the root dirnode URI that should be used." ], ["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 ."], - ["root-uri", "r", "private", - "Which dirnode URI should be used as a root directory. The " - "string 'private' is also, and means we should use the " - "private vdrive as found in the my_private_dir.cap file in the " - "--node-directory ."], + ["dir-uri", "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' " + "subdirectory of the --node-directory ."], ] def postOptions(self): @@ -39,16 +39,14 @@ class VDriveOptions(BaseOptions, usage.Options): node_url_file = os.path.join(self['node-directory'], "node.url") self['node-url'] = open(node_url_file, "r").read().strip() - # also compute self['root-uri'] - if self['root-uri'] == "private": - uri_file = os.path.join(self['node-directory'], "my_private_dir.cap") - self['root-uri'] = open(uri_file, "r").read().strip() - else: - from allmydata import uri - parsed = uri.from_string(self['root-uri']) - if not uri.IDirnodeURI.providedBy(parsed): - raise usage.UsageError("--root-uri must be a dirnode URI, or " - "'public' or 'private'") + # also compute self['dir-uri'] + if self['dir-uri'] == "root": + uri_file = os.path.join(self['node-directory'], "root_dir.cap") + self['dir-uri'] = open(uri_file, "r").read().strip() + from allmydata import uri + parsed = uri.NewDirectoryURI.init_from_human_encoding(self['dir-uri']) + if not uri.IDirnodeURI.providedBy(parsed): + raise usage.UsageError("--dir-uri must be a dir URI, or 'root'") class ListOptions(VDriveOptions): @@ -108,7 +106,7 @@ subCommands = [ def list(config, stdout, stderr): from allmydata.scripts import tahoe_ls rc = tahoe_ls.list(config['node-url'], - config['root-uri'], + config['dir-uri'], config['vdrive_pathname'], stdout, stderr) return rc @@ -118,7 +116,7 @@ def get(config, stdout, stderr): vdrive_filename = config['vdrive_filename'] local_filename = config['local_filename'] rc = tahoe_get.get(config['node-url'], - config['root-uri'], + config['dir-uri'], vdrive_filename, local_filename, stdout, stderr) @@ -142,7 +140,7 @@ def put(config, stdout, stderr): else: verbosity = 2 rc = tahoe_put.put(config['node-url'], - config['root-uri'], + config['dir-uri'], local_filename, vdrive_filename, verbosity, @@ -157,7 +155,7 @@ def rm(config, stdout, stderr): else: verbosity = 2 rc = tahoe_rm.rm(config['node-url'], - config['root-uri'], + config['dir-uri'], vdrive_pathname, verbosity, stdout, stderr) @@ -168,7 +166,7 @@ def mv(config, stdout, stderr): frompath = config['from'] topath = config['to'] rc = tahoe_mv.mv(config['node-url'], - config['root-uri'], + config['dir-uri'], frompath, topath, stdout, stderr) diff --git a/src/allmydata/scripts/create_node.py b/src/allmydata/scripts/create_node.py index d1dbb1ed..db56d45a 100644 --- a/src/allmydata/scripts/create_node.py +++ b/src/allmydata/scripts/create_node.py @@ -56,11 +56,11 @@ def create_client(basedir, config, out=sys.stdout, err=sys.stderr): f = open(os.path.join(basedir, "webport"), "w") f.write(config['webport'] + "\n") f.close() - # Create an empty my_private_dir.cap file, indicating that the node + # Create an empty root_dir.cap file, indicating that the node # should fill it with the URI after creating the directory. from allmydata.util import fileutil fileutil.make_dirs(os.path.join(basedir, "private"), 0700) - open(os.path.join(basedir, "private", "my_private_dir.cap"), "w") + open(os.path.join(basedir, "private", "root_dir.cap"), "w") print >>out, "client created in %s" % basedir print >>out, " please copy introducer.furl into the directory" diff --git a/src/allmydata/scripts/tahoe_get.py b/src/allmydata/scripts/tahoe_get.py index af577228..9b475695 100644 --- a/src/allmydata/scripts/tahoe_get.py +++ b/src/allmydata/scripts/tahoe_get.py @@ -2,10 +2,10 @@ import urllib -def get(nodeurl, root_uri, vdrive_fname, local_file, stdout, stderr): +def get(nodeurl, dir_uri, vdrive_fname, local_file, stdout, stderr): if nodeurl[-1] != "/": nodeurl += "/" - url = nodeurl + "uri/%s/" % urllib.quote(root_uri) + url = nodeurl + "uri/%s/" % urllib.quote(dir_uri) if vdrive_fname: url += urllib.quote(vdrive_fname) @@ -31,7 +31,7 @@ def main(): import optparse, re parser = optparse.OptionParser() parser.add_option("-u", "--nodeurl", dest="nodeurl") - parser.add_option("-r", "--root-uri", dest="rooturi") + parser.add_option("-r", "--dir-uri", 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 --root-uri") + raise ValueError("must provide --dir-uri") vdrive_fname = args[0] local_file = None diff --git a/src/allmydata/scripts/tahoe_ls.py b/src/allmydata/scripts/tahoe_ls.py index f010ae02..ad9fbcc6 100644 --- a/src/allmydata/scripts/tahoe_ls.py +++ b/src/allmydata/scripts/tahoe_ls.py @@ -3,10 +3,10 @@ import urllib import simplejson -def list(nodeurl, root_uri, vdrive_pathname, stdout, stderr): +def list(nodeurl, dir_uri, vdrive_pathname, stdout, stderr): if nodeurl[-1] != "/": nodeurl += "/" - url = nodeurl + "uri/%s/" % urllib.quote(root_uri) + url = nodeurl + "uri/%s/" % urllib.quote(dir_uri) if vdrive_pathname: url += urllib.quote(vdrive_pathname) url += "?t=json" @@ -34,7 +34,7 @@ def main(): import optparse, re parser = optparse.OptionParser() parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--root-uri", dest="rooturi") + parser.add_option("-r", "--dir-uri", 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 --root-uri") + raise ValueError("must provide --dir-uri") vdrive_pathname = "" if args: diff --git a/src/allmydata/scripts/tahoe_mv.py b/src/allmydata/scripts/tahoe_mv.py index 2306cc3f..be097a88 100644 --- a/src/allmydata/scripts/tahoe_mv.py +++ b/src/allmydata/scripts/tahoe_mv.py @@ -5,12 +5,12 @@ import urllib import simplejson from allmydata.scripts.common_http import do_http -def mv(nodeurl, root_uri, frompath, topath, stdout, stderr): +def mv(nodeurl, dir_uri, frompath, topath, stdout, stderr): frompath = urllib.quote(frompath) topath = urllib.quote(topath) if nodeurl[-1] != "/": nodeurl += "/" - url = nodeurl + "uri/%s/" % urllib.quote(root_uri) + url = nodeurl + "uri/%s/" % urllib.quote(dir_uri) data = urllib.urlopen(url + frompath + "?t=json").read() nodetype, attrs = simplejson.loads(data) diff --git a/src/allmydata/scripts/tahoe_put.py b/src/allmydata/scripts/tahoe_put.py index d2f046ae..f27e0fcf 100644 --- a/src/allmydata/scripts/tahoe_put.py +++ b/src/allmydata/scripts/tahoe_put.py @@ -3,7 +3,7 @@ import urllib from allmydata.scripts.common_http import do_http -def put(nodeurl, root_uri, local_fname, vdrive_fname, verbosity, +def put(nodeurl, dir_uri, local_fname, vdrive_fname, verbosity, stdout, stderr): """ @param verbosity: 0, 1, or 2, meaning quiet, verbose, or very verbose @@ -12,7 +12,7 @@ def put(nodeurl, root_uri, local_fname, vdrive_fname, verbosity, """ if nodeurl[-1] != "/": nodeurl += "/" - url = nodeurl + "uri/%s/" % urllib.quote(root_uri) + url = nodeurl + "uri/%s/" % urllib.quote(dir_uri) if vdrive_fname: url += urllib.quote(vdrive_fname) @@ -31,7 +31,7 @@ def main(): import optparse, re parser = optparse.OptionParser() parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--root-uri", dest="rooturi") + parser.add_option("-r", "--dir-uri", 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 --root-uri") + raise ValueError("must provide --dir-uri") local_file = args[0] vdrive_fname = None diff --git a/src/allmydata/scripts/tahoe_rm.py b/src/allmydata/scripts/tahoe_rm.py index e418ec35..32e95316 100644 --- a/src/allmydata/scripts/tahoe_rm.py +++ b/src/allmydata/scripts/tahoe_rm.py @@ -3,7 +3,7 @@ import urllib from allmydata.scripts.common_http import do_http -def rm(nodeurl, root_uri, vdrive_pathname, verbosity, stdout, stderr): +def rm(nodeurl, dir_uri, vdrive_pathname, verbosity, stdout, stderr): """ @param verbosity: 0, 1, or 2, meaning quiet, verbose, or very verbose @@ -11,7 +11,7 @@ def rm(nodeurl, root_uri, vdrive_pathname, verbosity, stdout, stderr): """ if nodeurl[-1] != "/": nodeurl += "/" - url = nodeurl + "uri/%s/" % urllib.quote(root_uri) + url = nodeurl + "uri/%s/" % urllib.quote(dir_uri) if vdrive_pathname: url += urllib.quote(vdrive_pathname) @@ -29,7 +29,7 @@ def main(): import optparse, re parser = optparse.OptionParser() parser.add_option("-u", "--node-url", dest="nodeurl") - parser.add_option("-r", "--root-uri", dest="rooturi") + parser.add_option("-r", "--dir-uri", 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 --root-uri") + raise ValueError("must provide --dir-uri") vdrive_pathname = args[0] diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 1b4375ef..7680b649 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -20,25 +20,25 @@ class CLI(unittest.TestCase): filenode_uri = uri.WriteableSSKFileURI(writekey="\x00"*16, fingerprint="\x00"*32) private_uri = uri.NewDirectoryURI(filenode_uri).to_string() - open("cli/test_options/my_private_dir.cap", "w").write(private_uri + "\n") + open("cli/test_options/root_dir.cap", "w").write(private_uri + "\n") o = cli.ListOptions() o.parseOptions(["--node-directory", "cli/test_options"]) self.failUnlessEqual(o['node-url'], "http://localhost:8080/") - self.failUnlessEqual(o['root-uri'], private_uri) + self.failUnlessEqual(o['dir-uri'], 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['root-uri'], private_uri) + self.failUnlessEqual(o['dir-uri'], private_uri) self.failUnlessEqual(o['vdrive_pathname'], "") o = cli.ListOptions() o.parseOptions(["--node-directory", "cli/test_options", - "--root-uri", "private"]) + "--dir-uri", "root"]) self.failUnlessEqual(o['node-url'], "http://localhost:8080/") - self.failUnlessEqual(o['root-uri'], private_uri) + self.failUnlessEqual(o['dir-uri'], 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", - "--root-uri", other_uri]) + "--dir-uri", other_uri]) self.failUnlessEqual(o['node-url'], "http://localhost:8080/") - self.failUnlessEqual(o['root-uri'], other_uri) + self.failUnlessEqual(o['dir-uri'], other_uri) self.failUnlessEqual(o['vdrive_pathname'], "") o = cli.ListOptions() o.parseOptions(["--node-directory", "cli/test_options", - "--root-uri", other_uri, "subdir"]) + "--dir-uri", other_uri, "subdir"]) self.failUnlessEqual(o['node-url'], "http://localhost:8080/") - self.failUnlessEqual(o['root-uri'], other_uri) + self.failUnlessEqual(o['dir-uri'], 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 465f4175..b7ef7499 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -71,7 +71,7 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): open(os.path.join(basedir, "webport"), "w").write("tcp:0:interface=127.0.0.1") if self.createprivdir: fileutil.make_dirs(os.path.join(basedir, "private")) - open(os.path.join(basedir, "private", "my_private_dir.cap"), "w") + open(os.path.join(basedir, "private", "root_dir.cap"), "w") open(os.path.join(basedir, "introducer.furl"), "w").write(self.introducer_furl) c = self.add_service(client.Client(basedir=basedir)) self.clients.append(c) @@ -567,15 +567,13 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): d.addCallback(self.log, "did _check_publish2") d.addCallback(self._do_publish_private) d.addCallback(self.log, "did _do_publish_private") - # now we also have (where "P" denotes clients[0]'s automatic private - # dir): + # now we also have (where "P" denotes a new dir): # P/personal/sekrit data # P/s2-rw -> /subdir1/subdir2/ # P/s2-ro -> /subdir1/subdir2/ (read-only) d.addCallback(self._check_publish_private) d.addCallback(self.log, "did _check_publish_private") d.addCallback(self._test_web) - d.addCallback(self._test_web_start) d.addCallback(self._test_control) d.addCallback(self._test_cli) # P now has four top-level children: @@ -654,11 +652,9 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): def _do_publish_private(self, res): self.smalldata = "sssh, very secret stuff" ut = upload.Data(self.smalldata) - d = self.clients[0].get_private_uri() + d = self.clients[0].create_empty_dirnode(wait_for_numpeers=self.numclients) d.addCallback(self.log, "GOT private directory") - def _got_root_uri(privuri): - assert privuri - privnode = self.clients[0].create_node_from_uri(privuri) + def _got_new_dir(privnode): rootnode = self.clients[0].create_node_from_uri(self._root_directory_uri) d1 = privnode.create_empty_directory("personal", wait_for_numpeers=self.numclients) d1.addCallback(self.log, "made P/personal") @@ -670,8 +666,9 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): d2.addCallback(lambda node: privnode.set_uri("s2-ro", s2node.get_readonly_uri(), wait_for_numpeers=self.numclients)) return d2 d1.addCallback(_got_s2) + d1.addCallback(lambda res: privnode) return d1 - d.addCallback(_got_root_uri) + d.addCallback(_got_new_dir) return d def _check_publish1(self, res): @@ -705,14 +702,11 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): d.addCallback(_got_filenode) return d - def _check_publish_private(self, res): + def _check_publish_private(self, resnode): # this one uses the path-based API - d = self.clients[0].get_private_uri() - def _got_private_uri(privateuri): - self._private_node = self.clients[0].create_node_from_uri(privateuri) - d.addCallback(_got_private_uri) + self._private_node = resnode - d.addCallback(lambda res: self._private_node.get_child_at_path("personal")) + d = self._private_node.get_child_at_path("personal") def _got_personal(personal): self._personal_node = personal return personal @@ -916,19 +910,6 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): return d - def _test_web_start(self, res): - basedir = self.clients[0].basedir - startfile = os.path.join(basedir, "private", "start.html") - self.failUnless(os.path.exists(startfile)) - start_html = open(startfile, "r").read() - self.failUnless(self.webish_url in start_html) - d = self.clients[0].get_private_uri() - def done(private_uri): - private_url = self.webish_url + "uri/" + private_uri - self.failUnless(private_url in start_html) - d.addCallback(done) - return d - def _test_runner(self, res): # exercise some of the diagnostic tools in runner.py @@ -1013,11 +994,11 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): nodeargs = [ "--node-url", self.webish_url, - "--root-uri", private_uri, + "--dir-uri", private_uri, ] public_nodeargs = [ "--node-url", self.webish_url, - "--root-uri", some_uri, + "--dir-uri", some_uri, ] TESTDATA = "I will not write the same thing over and over.\n" * 100 diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index e93be026..b1badbf4 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -275,23 +275,12 @@ class Web(WebMixin, unittest.TestCase): def _check(res): self.failUnless('Welcome To AllMyData' in res) self.failUnless('Tahoe' in res) - self.failUnless('personal vdrive not available.' in res) self.s.basedir = 'web/test_welcome' fileutil.make_dirs("web/test_welcome") fileutil.make_dirs("web/test_welcome/private") - self.ws.create_start_html("private_uri", - "web/test_welcome/private/start.html", - "web/test_welcome/node.url") return self.GET("/") d.addCallback(_check) - def _check2(res): - # We shouldn't link to the start.html page since we don't have a - # private directory cap. - self.failIf('To view your personal private non-shared' in res) - self.failIf('from your local filesystem:' in res) - self.failIf(os.path.abspath('web/test_welcome/private/start.html') in res) - d.addCallback(_check2) return d def test_provisioning_math(self): @@ -352,23 +341,6 @@ class Web(WebMixin, unittest.TestCase): d.addCallback(_check4) return d - def test_start_html(self): - fileutil.make_dirs("web") - fileutil.make_dirs("web/private") - startfile = "web/private/start.html" - nodeurlfile = "web/node.url" - self.ws.create_start_html("private_uri", startfile, nodeurlfile) - - self.failUnless(os.path.exists(startfile)) - start_html = open(startfile, "r").read() - self.failUnless(self.webish_url in start_html) - private_url = self.webish_url + "/uri/private_uri" - self.failUnless(private_url in start_html) - - self.failUnless(os.path.exists(nodeurlfile)) - nodeurl = open(nodeurlfile, "r").read().strip() - self.failUnless(nodeurl.startswith("http://localhost")) - def test_GET_FILEURL(self): d = self.GET(self.public_url + "/foo/bar.txt") d.addCallback(self.failUnlessIsBarDotTxt) diff --git a/src/allmydata/web/start.html b/src/allmydata/web/start.html deleted file mode 100644 index bcbadbd8..00000000 --- a/src/allmydata/web/start.html +++ /dev/null @@ -1,22 +0,0 @@ - - - AllMyData - Tahoe - - - - - - -

Welcome To Your AllMyData "Tahoe" Node!

- -
%(link_to_private_uri)s
- -
View this node's status page.
- - -
Please visit the Tahoe home page for -code updates and bug reporting.
- - - diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml index bc0deee7..05192537 100644 --- a/src/allmydata/web/welcome.xhtml +++ b/src/allmydata/web/welcome.xhtml @@ -10,8 +10,6 @@

Welcome To AllMyData "Tahoe"!

-
-
Please visit the Tahoe home page for code updates and bug reporting. The provisioning tool may also be useful.
diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index 84bd4aac..13fc476c 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -1,7 +1,7 @@ from base64 import b32encode import os.path -from twisted.application import service, strports, internet +from twisted.application import service, strports from twisted.web import static, resource, server, html, http from twisted.python import util, log from twisted.internet import defer @@ -1335,18 +1335,6 @@ class Root(rend.Page): ctx.fillSlots("peerid", nodeid_a) return ctx.tag - def render_private_vdrive(self, ctx, data): - basedir = IClient(ctx).basedir - start_html = os.path.abspath(os.path.join(basedir, "private", "start.html")) - basedir = IClient(ctx).basedir - if os.path.exists(start_html) and os.path.exists(os.path.join(basedir, "private", "my_private_dir.cap")): - return T.p["To view your personal private non-shared filestore, ", - "use this browser to open the following file from ", - "your local filesystem:", - T.pre[start_html], - ] - return T.p["personal vdrive not available."] - # this is a form where users can download files by URI def render_download_form(self, ctx, data): form = T.form(action="uri", method="get", @@ -1411,41 +1399,3 @@ class WebishServer(service.MultiService): # apparently 'ISite' does not exist #self.site._client = self.parent self._started.callback(None) - - def create_start_html(self, private_uri, startfile, nodeurl_file): - """ - Returns a deferred that eventually fires once the start.html page has - been created. - """ - self._started.addCallback(self._create_start_html, private_uri, startfile, nodeurl_file) - return self._started - - def _create_start_html(self, dummy, private_uri, startfile, nodeurl_file): - f = open(startfile, "w") - template = open(util.sibpath(__file__, "web/start.html"), "r").read() - # what is our webport? - s = self.listener - if isinstance(s, internet.TCPServer): - base_url = "http://localhost:%d" % s._port.getHost().port - elif isinstance(s, internet.SSLServer): - base_url = "https://localhost:%d" % s._port.getHost().port - else: - base_url = "UNKNOWN" # this will break the href - # TODO: emit a start.html that explains that we don't know - # how to create a suitable URL - if private_uri: - link_to_private_uri = "View your personal private non-shared filestore." % (base_url, private_uri) - fields = {"link_to_private_uri": link_to_private_uri, - "base_url": base_url, - } - else: - fields = {"link_to_private_uri": "", - "base_url": base_url, - } - f.write(template % fields) - f.close() - - f = open(nodeurl_file, "w") - # this file is world-readable - f.write(base_url + "\n") - f.close()