From fd6e66b83a8650aef3e2cf645808ebc5d040a50d Mon Sep 17 00:00:00 2001 From: David Stainton Date: Thu, 18 Jun 2015 23:01:55 -0700 Subject: [PATCH] Derive our own node-url, fixes magic-folder create test --- src/allmydata/scripts/common.py | 1 + src/allmydata/scripts/magic_folder_cli.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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): -- 2.45.2