Commit Graph

617 Commits

Author SHA1 Message Date
meejah
8e0e96da01 improve user experience on config errors 2018-08-17 15:53:59 -06:00
Jean-Paul Calderone
20084506b3 Handle all the status cases 2018-05-23 13:59:42 -04:00
Jean-Paul Calderone
9f8c90393f Remove dead synopsis definition 2018-04-26 15:10:02 -04:00
Chris Wood
c850638537 Fix PyInstaller builds
This commit contains a few small changes to fix PyInstaller frozen
builds (which were recently broken in a few ways by changes introduced
with `tahoe invite`, `tahoe daemonize`, and the addition of "setuptools
>= 28.8.0" to setup_requires) and removes a couple of hacks that are no
longer necessary to create working frozen tahoe executables with
PyInstaller.
2018-03-29 14:11:15 -04:00
Jean-Paul Calderone
fa567958c3 2 blank between top-level; 1 blank between methods
Just like PEP8 says
2018-03-26 20:15:45 -04:00
Jean-Paul Calderone
bafe043b73 Explicit new-style class 2018-03-26 20:12:47 -04:00
Jean-Paul Calderone
b78c6cc5ed Implement the progress reporting 2018-03-26 11:34:31 -04:00
Jean-Paul Calderone
6690aa7337 restore, with tests, checked counters 2018-03-26 10:27:19 -04:00
Jean-Paul Calderone
c55d2823ae first pass refactoring
now collect backup work up-front instead of mixed with processing
2018-03-26 10:02:42 -04:00
Jean-Paul Calderone
371965f7d4 Specify the new optFlag correctly 2018-03-19 15:12:59 -04:00
Ruben Pollan
136de7d7f7 Add storage_dir config field
On the [storage] section of the tahoe.cfg now there is a field
'storage_dir' where the path to the storage folder can be configured.
2018-03-19 11:20:04 -04:00
meejah
3466088717 add --json option for 'tahoe list-aliases'
some new tests to cover previously-uncovered code that changed
2018-01-05 18:07:52 -07:00
Brian Warner
5e62118e14 hush somewhat-real problems found by static analysis
These would have caused problems if a certain unlikely code path was taken:
mostly error-handling pathways.
2017-12-31 00:23:43 +01:00
Brian Warner
da4e7dcfbe hush a bunch of not-really-problems caught by the lgtm.com static analyzer
This is all minor stuff: unreachable debug code (that should be commented-out
instead of in an 'if False:' block), unnecessary 'pass' and 'global'
statements, redundantly-initialized variables. No behavior changes. Nothing
here was actually broken, it just looked suspicious to the static analysis at
https://lgtm.com/projects/g/tahoe-lafs/tahoe-lafs/alerts/?mode=list .
2017-12-31 00:19:41 +01:00
meejah
672475cb2b Multiple magic-folders
This moves all magic-folder configs to a single YAML
file. We load legacy config fine and don't mess with
legacy config unless you use a magic-folder command that
changes the config.

Increase test coverage
2017-12-05 10:34:48 -07:00
meejah
1b6f477549 Pull "config" handling out of Node and hide node-derivitives
This includes:

 - refactor to create_client and _Client
 - refactor to _IntroducerNode and create_introducer
2017-11-20 12:57:20 -07:00
meejah
50f8397c99 Merge branch 'invalid-pidfile' into delete-invalid-pidfile--lpirl
Conflicts:
	src/allmydata/scripts/startstop_node.py
	src/allmydata/test/cli/test_cli.py
2017-11-08 14:49:29 -07:00
Brian Warner
d1fd43aa4f tor/i2p: rename create_onion/create_dest to create_config 2017-11-03 00:24:46 -07:00
meejah
fd90346c88 Wait up to 60s for node start; improve messaging; look for errors 2017-09-20 00:55:19 -06:00
meejah
9375056b61 Split up startstop_node and add 'tahoe daemonize'
This sets the stage for further changes to the startup
process so that "async things" are done before we create
the Client instance while still reporting early failures
to the shell where "tahoe start" is running

Also adds a bunch of test-coverage for the things that got
moved around, even though they didn't have coverage before
2017-09-19 10:39:19 -06:00
Lukas Pirl
1bf032959f delete invalid PID file on `tahoe (re)start` 2017-08-24 15:22:25 +02:00
Lukas Pirl
dd9b951c4b fix crash when stopping/restarting with an invalid pidfile
in node directory
2017-08-23 20:23:15 +02:00
meejah
798bf57e28 Add 'tahoe invite' and 'tahoe create-node --join' commands
This opens a wormhole and sends appropriate JSON down
it to a tahoe-gui using a wormhole server running on
tahoe-lafs.org

The other end uses the 'tahoe create-node' command (with
new --join option) to read the configuration JSON from
a 'tahoe invite' command
2017-08-08 18:27:06 -06:00
Daira Hopwood
d3acf82776 Rename FilesystemOptions to FileStoreOptions. refs #2345
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-06-06 11:20:49 +01:00
Daira Hopwood
2055a66cf2 Doc changes that require more careful review. refs #2345
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-06-06 11:20:49 +01:00
Daira Hopwood
4723af6e2f LAFS now stands for "Least-Authority File Store" rather than "Least-Authority File System". refs #2345
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-06-06 11:20:49 +01:00
Brian Warner
f24681bfdc simplify rendering of path to tahoe.cfg 2017-04-10 11:56:33 -07:00
tpltnt
63bcc07e27 explicit path to tahoe.cfg in creation message 2017-04-07 16:59:17 +02:00
meejah
4f1dd95963 Add a 'tahoe status' command
This required also fixing the JSON output from
the "recent and active operations" page.
2017-04-04 12:48:41 -06:00
meejah
031a88c25f simplejson -> json 2017-02-23 15:21:36 -07:00
meejah
a9521b89a6 --readonly-uri for 'tahoe list-aliases' 2017-01-19 15:40:09 -07:00
Brian Warner
ee58637813 fix syntax (tcp=disabled, not =none), add test 2017-01-10 16:30:04 -08:00
David Stainton
3c22a3ce50 Set tcp = tor only if txtorcon is imported
for i2p this means tcp = none as long as txtorcon is not imported
2017-01-10 16:30:04 -08:00
Brian Warner
5651994501 magic_folder_cli: remove unnecessary conditional
(this increases our branch coverage by one)
2016-12-14 21:20:45 -08:00
meejah
e32b664b2b Adjust default poll_interval
Also adds a --poll-interval option to both 'magic-folder join'
and 'magic-folder create' so that the integration tests can pass
something "very short".
2016-12-14 20:29:41 -07:00
meejah
37c7d54bd3 keeps defaults in CreateClientOptions but makes shares-* required? 2016-12-13 19:50:19 -07:00
meejah
5b8be255d7 Set total/needed/happy from command-line 2016-12-13 18:52:45 -07:00
Brian Warner
6879622894 create-node: avoid introducer.furl=None
Previously, "tahoe create-node" without an --introducer= argument would
result in the literal string "None" being written into tahoe.cfg:

 [client]
 introducer.furl = None

We were using config.get("introducer",""), but that didn't suffice because
the key was actually present: it just had a value of None, which then got
stringified into "None" when writing out tahoe.cfg.

This briefly caused test/cli/test_create to fail, as the startup code tried
to parse "None" as a FURL. This only happened against a development version
of Foolscap which accidentally became sensitive to unparseable FURLs in
started Reconnectors. I fixed that in the final foolscap-0.12.5 release, so
we shouldn't hit this bug, but I wanted to fix it properly in the tahoe-side
source.
2016-12-08 15:37:49 -08:00
Brian Warner
5a5da0de2a magic_folder_cli.py: fix typo 2016-12-06 11:01:51 -08:00
meejah
783449b4f3 When tor or i2p options are present, confirm we have txi2p or txtorcon
We mock out some import methods and provide tests for providing
server-side or client-side tor/i2p options
2016-10-26 13:41:10 -06:00
str4d
6071c2b6f8
Implement i2p_provider and --listen=i2p
Closes ticket:2838
2016-10-23 20:30:01 -05:00
Brian Warner
6b9218ff22 create_node.py: use tor_provider to handle --listen=tor
This adds tor-related CLI arguments to "create-node" and
"create-introducer", to control exactly how we should be using Tor.

* --tor-launch
* --tor-executable=
* --tor-control-port=

I went with "--tor-launch" instead of "--launch-tor" for consistency. I
don't particularly like the grammatical flow of it, and it doesn't
actually put all the tor-related arguments next to each other in the
--help output (the flags are put in one block, then the parameters in
the next). But it seems slightly more consistent to start all the
tor-related argument names with a "--tor*" prefix.
2016-10-09 01:21:51 -04:00
David Stainton
e02d21aed1 Add tor listening options to create-node 2016-10-09 00:34:57 -04:00
Brian Warner
1e418ade83 create_node: slight refactoring
This prepares for various listeners to contribute values to tub.port and
tub.location, which will be helpful once Tor support is added.
2016-10-09 00:24:19 -04:00
Brian Warner
b5aaafbe68 create_node: add cosmetic newline in tahoe.cfg 2016-10-09 00:24:19 -04:00
Brian Warner
0eda544a73 create-node: introducer needs private/ too
All server-like nodes (storage servers and introducers both) will need
this for the tor state directory and .onion private key file, and it
needs to exist before the config is written, so tor onion-service
private keys can be placed there.

Also remove a redundant import.
2016-10-09 00:24:19 -04:00
Brian Warner
395f7cd4f0 create_node: prep for slow write_node_config()
This puts the right inlineCallbacks in place to allow
write_node_config() to return a Deferred. The upcoming Tor support will
need this (since it must wait for an .onion address to be allocated
before it can write tahoe.cfg's tub.port and tub.location lines).
2016-10-09 00:24:11 -04:00
Brian Warner
02ba2a05c3 implement --listen=none, use it for create-client
Improve docs on server configuration to explain --listen options.
2016-09-14 16:12:32 -07:00
Brian Warner
aa162f5a90 close more filehandles with context managers 2016-09-13 22:17:22 -07:00
David Stainton
9943a268ce Make the create-node --hide-ip option set [connections]tcp=tor 2016-09-13 10:15:45 +00:00
Brian Warner
a37b93ead9 create_node.py: refactor options 2016-09-13 01:14:48 -07:00
Brian Warner
3b17289569 create_node: simplify validation, clean up tests 2016-09-09 18:53:22 -07:00
Brian Warner
38ebdfac20 create-node: reject --listen=tcp without --hostname= 2016-09-09 18:53:22 -07:00
Brian Warner
7d3b4149ae remove leftover debug prints 2016-09-09 18:51:57 -07:00
David Stainton
e9c1075ac5 Make corrections from Daira's code review 2016-09-09 17:29:16 -07:00
David Stainton
83db7e8b43 Add create node args: listen, port, hostname, location
fixes ticket: 2773
2016-09-09 17:10:22 -07:00
Brian Warner
802cfc87fe CLI: allow dispatch functions to return Deferred
In addition, CLI functions are allowed to use sys.exit() instead of
always needing to return the exit code as an integer.

runner.py now knows about the blocking httplib calls in scripts/cli and
scripts/magic_folder, and uses deferToThread() to invoke them. Those
functions cannot return a Deferred: when rewrite them to use twisted.web
or treq, we'll remove this deferToThread call.

Option parsing was split out to a separate function for testing. We now
use twisted.internet.task.react() to start the reactor, which required
changing the way runner.py is tested.

closes ticket:2826
2016-09-09 15:52:42 -07:00
Brian Warner
720aa1a51f unify signature of all CLI dispatch functions
Now they all take a single 'config' argument, instead of some also
taking stdout/stderr args.
2016-09-09 15:40:01 -07:00
Brian Warner
57bed47495 runner.py: remove unused arguments 2016-09-09 15:40:01 -07:00
Brian Warner
8d9afdc27e CLI: remove 'debug trial', 'debug repl'
These are obsolete. Tests are run with 'tox', or by running 'trial
allmydata' from a populated virtualenv. A populated virtualenv is also
the right way to get a repl: just run 'python'.

refs ticket:2735
2016-09-09 15:37:28 -07:00
Brian Warner
74dc7194b6 validate_config: improve tests
closes ticket:2809
2016-09-06 19:23:51 -07:00
Brian Warner
d0da17adeb create-node: add --hide-ip, update docs
So "tahoe create-node --hide-ip" causes "reveal-IP-address = false" to
get written into tahoe.cfg . This also changes the default tahoe.cfg to
include "reveal-IP-address = true", for clarity.

refs ticket:1010
2016-09-01 23:24:38 -07:00
Brian Warner
076b3895dc config: change syntax of no-listen mode
We now use::

  tub.port = disabled
  tub.location = disabled

instead of using an empty value (but the key still being present, since
if the key is missing entirely, that means "be automatic").

closes ticket:2816
2016-09-01 21:26:48 -07:00
meejah
a6920d9799 Improve error-reporting from JSON APIs, and use it better in CLI
Improve error-handling for directories if you ask for JSON from
the /uri endpoint, but an error occurs (you get a proper HTTP
status code and a valid JSON object).

For 'tahoe magic-folder status' e now retrieve *all* the remote data
required in the CLI before doing anything else so that errors can be
shown immediately. Use the improved JSON endpoints to print better
errors.
2016-08-09 14:36:09 -06:00
meejah
87acfe968e pyflakes warnings 2016-07-21 12:35:59 -07:00
meejah
041aabd8c4 Error-handling and --debug option to print stack-trace for all magic-folder commands 2016-07-21 12:35:59 -07:00
meejah
4509c7dafd Fix magic-folder 'status' command 2016-07-21 12:35:59 -07:00
meejah
304da362f7 remove prints 2016-07-21 12:35:59 -07:00
meejah
a50d0e5c8b WIP and debugging things
Conflicts:
	src/allmydata/test/test_magic_folder.py
2016-07-21 12:35:59 -07:00
Daira Hopwood
807cfbf0dc Fix pyflakes warnings.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
meejah
9cfcb1b3aa remove humanize, use internal method, teach internal method to understand timedelta 2016-07-21 12:35:59 -07:00
meejah
c217d1f8f3 fix return-valid of leave 2016-07-21 12:35:59 -07:00
meejah
2573cf18ef Add simple auth-token to get JSON data 2016-07-21 12:35:59 -07:00
meejah
86abe56d91 Flesh out "tahoe magic-folder status" command
Adds:

 - a JSON endpoint
 - CLI to display information
 - QueuedItem + IQueuedItem for uploader/downloader
 - IProgress interface + PercentProgress implementation
 - progress= args to many upload/download APIs
2016-07-21 12:35:59 -07:00
David Stainton
3df0a82a38 Add cli stub for magic-folder status command 2016-07-21 12:35:59 -07:00
Daira Hopwood
9c9a4e7aa2 Add get_pathinfo.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
278762200d Teach magic-folder join to use configutil.
Author: David Stainton <david@leastauthority.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
David Stainton
189b1b2dc2 Remove magic_folder subsection from default tahoe.cfg 2016-07-21 12:35:59 -07:00
Daira Hopwood
cd1c166790 Improve the error reporting for 'tahoe magic-folder join/leave'. refs #2568
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
David Stainton
b4b5590b00 teach leave to: remove magic_folder section of config 2016-07-21 12:35:59 -07:00
David Stainton
d6e68129ab Add simple magic-folder leave command 2016-07-21 12:35:59 -07:00
David Stainton
8ff7642fba Teach join to also check for existing magicfolder db file 2016-07-21 12:35:59 -07:00
David Stainton
aea2cf2890 Prevent magic-folder join if already joined. 2016-07-21 12:35:59 -07:00
Daira Hopwood
dacf6ef633 More path fixes.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
a622109a87 Don't include [magic_folder]enabled and local.directory fields by default.
Add a comment reminding to do the field modification properly.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
6fb7f86855 Don't use a long path for the [magic_folder]local.directory field.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
2a79252a72 Fix some path Unixisms.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
2a7bb6f444 Eliminate duplicate parsing of invite code.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
643a105991 URIs are strs.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
59eede8e88 Aliases and nicknames are Unicode.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
bb596b017d Fix call to argv_to_abspath. Also rename localdir to local_dir.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
David Stainton
a1beef34a7 Attempt to fix cli tests 2016-07-21 12:35:59 -07:00
David Stainton
0789d295a6 Fix tests by submitting unicode args instead of str 2016-07-21 12:35:59 -07:00
David Stainton
16275cb8f6 Teach magic-folder join to use argv_to_abspath
- also we modify argv_to_abspath to through a usage error
if the name starts with a '-'

- add a test
currently the tests fail
2016-07-21 12:35:59 -07:00
David Stainton
941f67f3b0 Use argv_to_abspath for magic-folder join file path arg 2016-07-21 12:35:59 -07:00
Daira Hopwood
5754c01cb5 Add magicfolderdb.py.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
31ab5cf4ed Correct a string-type error.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
e03a1e3361 WIP.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
76a178969d Move backupdb.py to src/allmydata.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Brian Warner
93bb3e995a stats-gatherer: add --hostname/--location/--port
Updates docs, tests, explains how to update an old gatherer.
2016-05-04 17:58:45 -07:00