]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
drop-upload: rename the 'upload.uri' parameter to 'upload.dircap', and a couple of...
authorZooko O'Whielacronx <zooko@zooko.com>
Tue, 9 Aug 2011 22:05:08 +0000 (15:05 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Tue, 9 Aug 2011 22:05:08 +0000 (15:05 -0700)
I rerecorded this patch, originally by David-Sarah, to use "darcs replace" instead of editing to do the renames. This uncovered one missed rename in Client.init_drop_uploader. (Which also means that code isn't exercised by the current unit tests.)
refs #1429

docs/frontends/drop-upload.rst
src/allmydata/client.py
src/allmydata/frontends/drop_upload.py
src/allmydata/scripts/create_node.py

index ed2d4167f2a3aa5c1d0153d5dc9012c47b86470a..cb3a2be23496407b0bb380403136071293d4f7db 100644 (file)
@@ -43,14 +43,14 @@ gateway's ``tahoe.cfg`` file.
 ``enabled = (boolean, optional)``
 
     If this is ``True``, drop-upload will be enabled (provided that the
-    ``upload.uri`` and ``local.directory`` fields are also set). The default
-    value is ``False``.
+    ``upload.dircap`` and ``local.directory`` fields are also set). The
+    default value is ``False``.
 
-``upload.uri = (URI)``
+``upload.dircap = (directory writecap)``
 
-    This is the Tahoe URI of an existing mutable directory to be used as
-    the target of uploads. It must be the full URI of the directory
-    (starting with ``URI:DIR2:``), and cannot include an alias or path.
+    This is a writecap pointing to an existing mutable directory to be used
+    as the target of uploads. It will start with ``URI:DIR2:``, and cannot
+    include an alias or path.
 
 ``local.directory = (UTF-8 path)``
 
index eb3d76790b5c884cf6fe324063d87ca4c83f700c..7713b4fe022f50721d42e91eb38c97c103349c1f 100644 (file)
@@ -424,19 +424,19 @@ class Client(node.Node, pollmixin.PollMixin):
 
     def init_drop_uploader(self):
         if self.get_config("drop_upload", "enabled", False, boolean=True):
-            upload_uri = self.get_config("drop_upload", "upload.uri", None)
+            upload_dircap = self.get_config("drop_upload", "upload.dircap", None)
             local_dir_utf8 = self.get_config("drop_upload", "local.directory", None)
 
-            if upload_uri and local_dir_utf8:
+            if upload_dircap and local_dir_utf8:
                 try:
                     from allmydata.frontends import drop_upload
-                    s = drop_upload.DropUploader(self, upload_uri, local_dir_utf8)
+                    s = drop_upload.DropUploader(self, upload_dircap, local_dir_utf8)
                     s.setServiceParent(self)
                     s.start()
                 except Exception, e:
                     self.log("couldn't start drop-uploader: %r", args=(e,))
             else:
-                self.log("couldn't start drop-uploader: upload.uri or local.directory not specified")
+                self.log("couldn't start drop-uploader: upload.dircap or local.directory not specified")
 
     def _check_hotline(self, hotline_file):
         if os.path.exists(hotline_file):
index 71c471bb8e43cb0543b1038365868778b822eec7..c949b4d77a2c1e6e0679a9b6d9603547576ae745 100644 (file)
@@ -13,7 +13,7 @@ from allmydata.immutable.upload import FileName
 
 
 class DropUploader(service.MultiService):
-    def __init__(self, client, upload_uri, local_dir_utf8, inotify=None):
+    def __init__(self, client, upload_dircap, local_dir_utf8, inotify=None):
         service.MultiService.__init__(self)
 
         try:
@@ -23,7 +23,8 @@ class DropUploader(service.MultiService):
             else:
                 local_dir = local_dir_u.encode(get_filesystem_encoding())
         except (UnicodeEncodeError, UnicodeDecodeError):
-            raise AssertionError("The drop-upload path %s was not valid UTF-8 or could not be represented in the filesystem encoding."
+            raise AssertionError("The '[drop_upload] local.directory' parameter %s was not valid UTF-8 or "
+                                 "could not be represented in the filesystem encoding."
                                  % quote_output(local_dir_utf8))
 
         self._client = client
@@ -38,12 +39,12 @@ class DropUploader(service.MultiService):
         if not self._local_path.isdir():
             raise AssertionError("The drop-upload local path %r was not an existing directory." % quote_output(local_dir_u))
 
-        # TODO: allow a path rather than an URI.
-        self._parent = self._client.create_node_from_uri(upload_uri)
+        # TODO: allow a path rather than a cap URI.
+        self._parent = self._client.create_node_from_uri(upload_dircap)
         if not IDirectoryNode.providedBy(self._parent):
-            raise AssertionError("The drop-upload remote URI is not a directory URI.")
+            raise AssertionError("The '[drop_upload] upload.dircap' parameter does not refer to a directory.")
         if self._parent.is_unknown() or self._parent.is_readonly():
-            raise AssertionError("The drop-upload remote URI does not refer to a writeable directory.")
+            raise AssertionError("The '[drop_upload] upload.dircap' parameter is not a writecap to a directory.")
 
         self._uploaded_callback = lambda ign: None
 
index 9c223bf099411c0050c851cea473fb8733a9adb3..294f6dd82f0d3c3c0d01236cf83df13e2f3862a3 100644 (file)
@@ -155,8 +155,8 @@ def create_node(config, out=sys.stdout, err=sys.stderr):
     c.write("[drop_upload]\n")
     c.write("# Shall this node automatically upload files created or modified in a local directory?\n")
     c.write("enabled = false\n")
-    c.write("# This must be an URI for a writeable directory.\n")
-    c.write("upload.uri =\n")
+    c.write("# This must be a mutable directory writecap.\n")
+    c.write("upload.dircap =\n")
     c.write("local.directory = ~/drop_upload\n")
     c.write("\n")