From: David Stainton <dstainton415@gmail.com>
Date: Fri, 19 Jun 2015 06:01:55 +0000 (-0700)
Subject: Derive our own node-url, fixes magic-folder create test
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/frontends/wapi.txt?a=commitdiff_plain;h=b24dbf77c322273376dd529e3c9c70b6fc4932eb;p=tahoe-lafs%2Ftahoe-lafs.git

Derive our own node-url, fixes magic-folder create test
---

diff --git a/src/allmydata/scripts/common.py b/src/allmydata/scripts/common.py
index 666176d7..3bfe9750 100644
--- a/src/allmydata/scripts/common.py
+++ b/src/allmydata/scripts/common.py
@@ -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']:
diff --git a/src/allmydata/scripts/magic_folder_cli.py b/src/allmydata/scripts/magic_folder_cli.py
index 04dec10d..6eb7b43f 100644
--- a/src/allmydata/scripts/magic_folder_cli.py
+++ b/src/allmydata/scripts/magic_folder_cli.py
@@ -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):