Merge pull request #2446 from KPrasch/help

Help command displaying default config and log paths
pull/2369/head
David Núñez 2020-11-25 12:00:32 +01:00 committed by GitHub
commit bf851eb83e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 77 additions and 13 deletions

View File

@ -195,6 +195,12 @@ Assuming geth is running locally, configure and run an Ursula using port and vol
5. Monitor Worker
^^^^^^^^^^^^^^^^^
Ursula's Logs
~~~~~~~~~~~~~~
A reliable way to check the status of a worker node is to view the logs. As a shortcut, nucypher's
logs can be viewed from the command line using ``tail``: `tail -f $(nucypher --logging-path)/nucypher.log`
Status Page
~~~~~~~~~~~
Once Ursula is running, you can view its public status page at ``https://<node_ip>:9151/status``.

View File

@ -203,7 +203,16 @@ Q: How do I maximize the inflation-based rewards I will receive?
Q: Where is my Ursula config path?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Ubuntu/Debian - ``$HOME/.local/share/nucypher/ursula.json``
Default configuration and logging paths can be displayed using the command line:
Configuration path - ``nucypher --config-path``
Default logging path - ``nucypher --logging-path``
On Ubuntu/Debian the default ursula configuration path is``$HOME/.local/share/nucypher/ursula.json``,
however if you have more than one ursula configuration, the filename will include the checksum address:
``$HOME/.local/share/nucypher/ursula-0xdeadbeef.json``.
To inspect the config path for configuration files run ``ls $(nucypher --config-path)``.
Q: What is the difference between Standard Installation and Development Installation?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -0,0 +1 @@
Introduces `--config-path` and `--logging-path` CLI flags displaying default nucypher directories

View File

@ -17,12 +17,29 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
import click
from nucypher.cli.commands import alice, bob, dao, enrico, felix, multisig, stake, status, ursula, worklock, cloudworkers
from nucypher.cli.painting.help import echo_version
from nucypher.cli.commands import (
alice,
bob,
dao,
enrico,
felix,
multisig,
stake,
status,
ursula,
worklock,
cloudworkers
)
from nucypher.cli.painting.help import echo_version, echo_config_root_path, echo_logging_root_path
@click.group()
@click.option('--version', help="Echo the CLI version", is_flag=True, callback=echo_version, expose_value=False, is_eager=True)
@click.option('--version', help="Echo the CLI version",
is_flag=True, callback=echo_version, expose_value=False, is_eager=True)
@click.option('--config-path', help="Echo the configuration root directory path",
is_flag=True, callback=echo_config_root_path, expose_value=False, is_eager=True)
@click.option('--logging-path', help="Echo the logging root directory path",
is_flag=True, callback=echo_logging_root_path, expose_value=False, is_eager=True)
def nucypher_cli():
"""Top level command for all things nucypher."""

View File

@ -19,6 +19,7 @@ import click
from nucypher.blockchain.eth.sol.__conf__ import SOLIDITY_COMPILER_VERSION
from nucypher.characters.banners import NUCYPHER_BANNER
from nucypher.config.constants import DEFAULT_CONFIG_ROOT, USER_LOG_DIR
def echo_version(ctx, param, value):
@ -35,6 +36,20 @@ def echo_solidity_version(ctx, param, value):
ctx.exit()
def echo_config_root_path(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.secho(DEFAULT_CONFIG_ROOT)
ctx.exit()
def echo_logging_root_path(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.secho(USER_LOG_DIR)
ctx.exit()
def paint_new_installation_help(emitter, new_configuration):
character_config_class = new_configuration.__class__
character_name = character_config_class.NAME.lower()

View File

@ -41,13 +41,6 @@ def registry_filepath(temp_dir_path):
return os.path.join(temp_dir_path, 'nucypher-test-autodeploy.json')
def test_echo_solidity_version(click_runner):
version_args = ('--solidity-version', )
result = click_runner.invoke(deploy, version_args, catch_exceptions=False)
assert result.exit_code == 0
assert str(SOLIDITY_COMPILER_VERSION) in result.output, 'Solidity version text was not produced.'
def test_deploy_single_contract(click_runner, tempfile_path):
# Perform the Test

View File

@ -19,8 +19,10 @@ import click
import pytest
import nucypher
from nucypher.blockchain.eth.sol.__conf__ import SOLIDITY_COMPILER_VERSION
from nucypher.cli.commands.deploy import deploy
from nucypher.cli.main import ENTRY_POINTS, nucypher_cli
from nucypher.config.constants import USER_LOG_DIR, DEFAULT_CONFIG_ROOT
def test_echo_nucypher_version(click_runner):
@ -70,3 +72,24 @@ def test_nucypher_deploy_help_message(click_runner):
result = click_runner.invoke(deploy, help_args, catch_exceptions=False)
assert result.exit_code == 0
assert 'deploy [OPTIONS] COMMAND [ARGS]' in result.output, 'Missing or invalid help text was produced.'
def test_echo_solidity_version(click_runner):
version_args = ('--solidity-version', )
result = click_runner.invoke(deploy, version_args, catch_exceptions=False)
assert result.exit_code == 0
assert str(SOLIDITY_COMPILER_VERSION) in result.output, 'Solidity version text was not produced.'
def test_echo_config_root(click_runner):
version_args = ('--config-path', )
result = click_runner.invoke(nucypher_cli, version_args, catch_exceptions=False)
assert result.exit_code == 0
assert DEFAULT_CONFIG_ROOT in result.output, 'Configuration path text was not produced.'
def test_echo_logging_root(click_runner):
version_args = ('--logging-path', )
result = click_runner.invoke(nucypher_cli, version_args, catch_exceptions=False)
assert result.exit_code == 0
assert USER_LOG_DIR in result.output, 'Log path text was not produced.'