runner: make most commands use ~/.tahoe by default (create-client, start/stop/restart, all CLI tools, but *not* create-introducer

This commit is contained in:
Brian Warner 2007-10-11 01:54:23 -07:00
parent a29ab33379
commit 7fd1964c6f
3 changed files with 4 additions and 9 deletions

View File

@ -40,7 +40,7 @@ class BasedirMixin:
self.basedirs.extend(args) self.basedirs.extend(args)
else: else:
if len(args) == 0 and not self.basedirs: if len(args) == 0 and not self.basedirs:
self.basedirs.append(".") self.basedirs.append(os.path.expanduser("~/.tahoe"))
if len(args) > 0: if len(args) > 0:
self.basedirs.append(args[0]) self.basedirs.append(args[0])
if len(args) > 1: if len(args) > 1:
@ -48,7 +48,7 @@ class BasedirMixin:
class NoDefaultBasedirMixin(BasedirMixin): class NoDefaultBasedirMixin(BasedirMixin):
def parseArgs(self, *args): def parseArgs(self, *args):
# create-client won't default to --basedir=. # create-client won't default to --basedir=~/.tahoe
self.basedirs = [] self.basedirs = []
if self['basedir']: if self['basedir']:
self.basedirs.append(self['basedir']) self.basedirs.append(self['basedir'])

View File

@ -1,9 +1,9 @@
import os, sys import os, sys
from twisted.python import usage from twisted.python import usage
from allmydata.scripts.common import NoDefaultBasedirMixin from allmydata.scripts.common import BasedirMixin, NoDefaultBasedirMixin
class CreateClientOptions(NoDefaultBasedirMixin, usage.Options): class CreateClientOptions(BasedirMixin, usage.Options):
optParameters = [ optParameters = [
["basedir", "C", None, "which directory to create the client in"], ["basedir", "C", None, "which directory to create the client in"],
] ]

View File

@ -44,11 +44,6 @@ class CreateNode(unittest.TestCase):
["create-client", "basedir", "extraarg"], ["create-client", "basedir", "extraarg"],
run_by_human=False) run_by_human=False)
self.failUnlessRaises(usage.UsageError,
runner.runner,
["create-client"],
run_by_human=False)
def test_introducer(self): def test_introducer(self):
basedir = self.workdir("test_introducer") basedir = self.workdir("test_introducer")
c1 = os.path.join(basedir, "c1") c1 = os.path.join(basedir, "c1")