mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-01 18:56:41 +00:00
client.py: allow operation without vdrive.furl, for storage-only no-UI nodes
This commit is contained in:
parent
59f4a5abe8
commit
8907e04ef5
@ -40,7 +40,6 @@ class Client(node.Node, Referenceable):
|
||||
self.add_service(StorageServer(os.path.join(basedir, self.STOREDIR)))
|
||||
self.add_service(Uploader())
|
||||
self.add_service(Downloader())
|
||||
self.add_service(VDrive())
|
||||
WEBPORTFILE = os.path.join(self.basedir, self.WEBPORTFILE)
|
||||
if os.path.exists(WEBPORTFILE):
|
||||
f = open(WEBPORTFILE, "r")
|
||||
@ -54,11 +53,14 @@ class Client(node.Node, Referenceable):
|
||||
self.introducer_furl = f.read().strip()
|
||||
f.close()
|
||||
|
||||
self.global_vdrive_furl = None
|
||||
GLOBAL_VDRIVE_FURL_FILE = os.path.join(self.basedir,
|
||||
self.GLOBAL_VDRIVE_FURL_FILE)
|
||||
if os.path.exists(GLOBAL_VDRIVE_FURL_FILE):
|
||||
f = open(GLOBAL_VDRIVE_FURL_FILE, "r")
|
||||
self.global_vdrive_furl = f.read().strip()
|
||||
f.close()
|
||||
self.add_service(VDrive())
|
||||
|
||||
hotline_file = os.path.join(self.basedir,
|
||||
self.SUICIDE_PREVENTION_HOTLINE_FILE)
|
||||
@ -95,6 +97,7 @@ class Client(node.Node, Referenceable):
|
||||
|
||||
self.register_control()
|
||||
|
||||
if self.global_vdrive_furl:
|
||||
self.vdrive_connector = self.tub.connectTo(self.global_vdrive_furl,
|
||||
self._got_vdrive)
|
||||
|
||||
|
@ -21,6 +21,12 @@ class Basic(unittest.TestCase):
|
||||
open(os.path.join(basedir, "vdrive.furl"), "w").write("")
|
||||
c = client.Client(basedir)
|
||||
|
||||
def test_loadable_without_vdrive(self):
|
||||
basedir = "test_client.Basic.test_loadable_without_vdrive"
|
||||
os.mkdir(basedir)
|
||||
open(os.path.join(basedir, "introducer.furl"), "w").write("")
|
||||
c = client.Client(basedir)
|
||||
|
||||
def test_permute(self):
|
||||
basedir = "test_client.Basic.test_permute"
|
||||
os.mkdir(basedir)
|
||||
|
Loading…
Reference in New Issue
Block a user