Sketch of where SFTP setup needs to happen.

This commit is contained in:
Itamar Turner-Trauring
2021-01-07 11:25:26 -05:00
parent dc5ac4a112
commit 054af4b76e
2 changed files with 23 additions and 10 deletions

View File

@ -7,6 +7,7 @@ from os import mkdir, listdir, environ
from os.path import join, exists from os.path import join, exists
from tempfile import mkdtemp, mktemp from tempfile import mkdtemp, mktemp
from functools import partial from functools import partial
from json import loads
from foolscap.furl import ( from foolscap.furl import (
decode_furl, decode_furl,
@ -37,6 +38,8 @@ from util import (
_tahoe_runner_optional_coverage, _tahoe_runner_optional_coverage,
await_client_ready, await_client_ready,
TahoeProcess, TahoeProcess,
cli,
_run_node,
) )
@ -350,6 +353,15 @@ def alice(reactor, temp_dir, introducer_furl, flog_gatherer, storage_nodes, requ
) )
) )
await_client_ready(process) await_client_ready(process)
cli(process, "create-alias", "test")
rwcap = loads(cli(process, "list-aliases", "--json"))["test"]["readwrite"]
# TODO at this point we need to:
# 1. configure sftpd
# 2. add an sftp access file with username, password, and rwcap
# 3. eventually, add sftp access with public key
process.kill()
pytest_twisted.blockon(_run_node(reactor, process.node_dir, request, None))
await_client_ready(process)
return process return process

View File

@ -5,6 +5,7 @@ from os import mkdir, environ
from os.path import exists, join from os.path import exists, join
from six.moves import StringIO from six.moves import StringIO
from functools import partial from functools import partial
from subprocess import check_output
from twisted.python.filepath import ( from twisted.python.filepath import (
FilePath, FilePath,
@ -175,6 +176,10 @@ class TahoeProcess(object):
u"portnum", u"portnum",
) )
def kill(self):
"""Kill the process, block until it's done."""
_cleanup_tahoe_process(self.transport, self.transport.exited)
def __str__(self): def __str__(self):
return "<TahoeProcess in '{}'>".format(self._node_dir) return "<TahoeProcess in '{}'>".format(self._node_dir)
@ -390,17 +395,13 @@ def await_file_vanishes(path, timeout=10):
raise FileShouldVanishException(path, timeout) raise FileShouldVanishException(path, timeout)
def cli(request, reactor, node_dir, *argv): def cli(node, *argv):
""" """
Run a tahoe CLI subcommand for a given node, optionally running Run a tahoe CLI subcommand for a given node in a blocking manner, returning
under coverage if '--coverage' was supplied. the output.
""" """
proto = _CollectOutputProtocol() arguments = ["tahoe", '--node-directory', node.node_dir]
_tahoe_runner_optional_coverage( return check_output(arguments + list(argv))
proto, reactor, request,
['--node-directory', node_dir] + list(argv),
)
return proto.done
def node_url(node_dir, uri_fragment): def node_url(node_dir, uri_fragment):