Derive our own node-url, fixes magic-folder create test
authorDavid Stainton <dstainton415@gmail.com>
Fri, 19 Jun 2015 06:01:55 +0000 (23:01 -0700)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 30 Sep 2015 15:45:22 +0000 (16:45 +0100)
src/allmydata/scripts/common.py
src/allmydata/scripts/magic_folder_cli.py

index 666176d72b37af6d9e91853477e75351384ae14e..3bfe97500e4200dbb5dea5b568e55a2a69166ef0 100644 (file)
@@ -80,6 +80,7 @@ class BasedirOptions(BaseOptions):
         else:
             raise usage.UsageError("No default basedir available, you must provide one with --node-directory, --basedir, or a basedir argument")
         self['basedir'] = b
+        self['node-directory'] = b
 
     def postOptions(self):
         if not self['basedir']:
index 04dec10d33004c4b91fa68f636ea651097fdcbf6..6eb7b43f41b72731e8bd29246239c54a113a29d3 100644 (file)
@@ -1,4 +1,6 @@
 
+import os
+
 from twisted.python import usage, failure
 from allmydata.scripts.common import BaseOptions
 from .common import BaseOptions, BasedirOptions
@@ -6,6 +8,7 @@ from .common import BaseOptions, BasedirOptions
 class CreateOptions(BasedirOptions):
     nickname = None
     localdir = None
+    synopsis = "MAGIC_ALIAS: [NICKNAME LOCALDIR]"
     def parseArgs(self, alias, nickname=None, localdir=None):
         BasedirOptions.parseArgs(self)
         self.alias = alias
@@ -13,12 +16,12 @@ class CreateOptions(BasedirOptions):
         self.localdir = localdir
         if self.nickname and not self.localdir:
             raise usage.UsageError("must provide both")
-    synopsis = "MAGIC_ALIAS: [NICKNAME LOCALDIR]"
+        node_url_file = os.path.join(self['node-directory'], "node.url")
+        self['node-url'] = open(node_url_file, "r").read().strip()
 
 def create(options):
     from allmydata.scripts import tahoe_add_alias
     rc = tahoe_add_alias.create_alias(options)
-    #print "node dir %s" % (options['node-directory'],)
     return rc
 
 class InviteOptions(BasedirOptions):