Esempio n. 1
0
def invite(options):
    if options.parent['node-directory']:
        basedir = argv_to_abspath(options.parent['node-directory'])
    else:
        basedir = get_default_nodedir()
    config = read_config(basedir, u"")
    out = options.stdout
    err = options.stderr

    try:
        introducer_furl = get_introducer_furl(basedir, config)
    except Exception as e:
        print("Can't find introducer FURL for node '{}': {}".format(basedir, str(e)), file=err)
        raise SystemExit(1)

    nick = options['nick']

    remote_config = {
        "shares-needed": options["shares-needed"] or config.get_config('client', 'shares.needed'),
        "shares-total": options["shares-total"] or config.get_config('client', 'shares.total'),
        "shares-happy": options["shares-happy"] or config.get_config('client', 'shares.happy'),
        "nickname": nick,
        "introducer": introducer_furl,
    }

    yield _send_config_via_wormhole(options, remote_config)
    print("Completed successfully", file=out)
Esempio n. 2
0
def invite(options):
    if options.parent['node-directory']:
        basedir = argv_to_abspath(options.parent['node-directory'])
    else:
        basedir = get_default_nodedir()
    config = configutil.get_config(join(basedir, 'tahoe.cfg'))
    out = options.stdout
    err = options.stderr

    try:
        introducer_furl = get_introducer_furl(basedir, config)
    except Exception as e:
        print("Can't find introducer FURL for node '{}': {}".format(basedir, str(e)), file=err)
        raise SystemExit(1)

    nick = options['nick']

    remote_config = {
        "shares-needed": options["shares-needed"] or config.get('client', 'shares.needed'),
        "shares-total": options["shares-total"] or config.get('client', 'shares.total'),
        "shares-happy": options["shares-happy"] or config.get('client', 'shares.happy'),
        "nickname": nick,
        "introducer": introducer_furl,
    }

    yield _send_config_via_wormhole(options, remote_config)
    print("Completed successfully", file=out)
Esempio n. 3
0
 def postOptions(self):
     if self.parent['node-directory']:
         self['node-directory'] = argv_to_abspath(self.parent['node-directory'])
     else:
         self['node-directory'] = get_default_nodedir()
Esempio n. 4
0
from twisted.python import usage
from twisted.internet import defer, task, threads

from allmydata.version_checks import get_package_versions_string
from allmydata.scripts.common import get_default_nodedir
from allmydata.scripts import debug, create_node, cli, \
    stats_gatherer, admin, tahoe_daemonize, tahoe_start, \
    tahoe_stop, tahoe_restart, tahoe_run, tahoe_invite
from allmydata.util.encodingutil import quote_output, quote_local_unicode_path, get_io_encoding
from allmydata.util.eliotutil import (
    opt_eliot_destination,
    opt_help_eliot_destinations,
    eliot_logging_service,
)

_default_nodedir = get_default_nodedir()

NODEDIR_HELP = ("Specify which Tahoe node directory should be used. The "
                "directory should either contain a full Tahoe node, or a "
                "file named node.url that points to some other Tahoe node. "
                "It should also contain a file named '" +
                os.path.join('private', 'aliases') +
                "' which contains the mapping from alias name to root "
                "dirnode URI.")
if _default_nodedir:
    NODEDIR_HELP += " [default for most commands: " + quote_local_unicode_path(
        _default_nodedir) + "]"

# XXX all this 'dispatch' stuff needs to be unified + fixed up
_control_node_dispatch = {
    "daemonize": tahoe_daemonize.daemonize,
Esempio n. 5
0
 def data_list_aliases(self, ctx, data):
     aliases = get_aliases(get_default_nodedir())
     return sorted(aliases.items())
Esempio n. 6
0
 def postOptions(self):
     if self.parent['node-directory']:
         self['node-directory'] = argv_to_abspath(self.parent['node-directory'])
     else:
         self['node-directory'] = get_default_nodedir()
Esempio n. 7
0
from twisted.python import usage
from twisted.internet import defer, task, threads

from allmydata.scripts.common import get_default_nodedir
from allmydata.scripts import debug, create_node, cli, \
    stats_gatherer, admin, magic_folder_cli, tahoe_daemonize, tahoe_start, \
    tahoe_stop, tahoe_restart, tahoe_run, tahoe_invite
from allmydata.util.encodingutil import quote_output, quote_local_unicode_path, get_io_encoding
from allmydata.util.eliotutil import (
    opt_eliot_destination,
    opt_help_eliot_destinations,
    eliot_logging_service,
)

_default_nodedir = get_default_nodedir()

NODEDIR_HELP = ("Specify which Tahoe node directory should be used. The "
                "directory should either contain a full Tahoe node, or a "
                "file named node.url that points to some other Tahoe node. "
                "It should also contain a file named '"
                + os.path.join('private', 'aliases') +
                "' which contains the mapping from alias name to root "
                "dirnode URI.")
if _default_nodedir:
    NODEDIR_HELP += " [default for most commands: " + quote_local_unicode_path(_default_nodedir) + "]"


# XXX all this 'dispatch' stuff needs to be unified + fixed up
_control_node_dispatch = {
    "daemonize": tahoe_daemonize.daemonize,