Beispiel #1
0
 def parseArgs(self, basedir=None):
     BasedirOptions.parseArgs(self, basedir)
     for name in ["shares-needed", "shares-happy", "shares-total"]:
         try:
             int(self[name])
         except ValueError:
             raise UsageError("--{} must be an integer".format(name))
Beispiel #2
0
    def parseArgs(self, basedir=None, *twistd_args):
        # This can't handle e.g. 'tahoe start --nodaemon', since '--nodaemon'
        # looks like an option to the tahoe subcommand, not to twistd. So you
        # can either use 'tahoe start' or 'tahoe start NODEDIR
        # --TWISTD-OPTIONS'. Note that 'tahoe --node-directory=NODEDIR start
        # --TWISTD-OPTIONS' also isn't allowed, unfortunately.

        BasedirOptions.parseArgs(self, basedir)
        self.twistd_args = twistd_args
Beispiel #3
0
 def parseArgs(self, basedir=None):
     BasedirOptions.parseArgs(self, basedir)
     for name in ["shares-needed", "shares-happy", "shares-total"]:
         try:
             int(self[name])
         except ValueError:
             raise UsageError(
                 "--{} must be an integer".format(name)
             )
Beispiel #4
0
    def parseArgs(self, basedir=None, *twistd_args):
        # This can't handle e.g. 'tahoe start --nodaemon', since '--nodaemon'
        # looks like an option to the tahoe subcommand, not to twistd. So you
        # can either use 'tahoe start' or 'tahoe start NODEDIR
        # --TWISTD-OPTIONS'. Note that 'tahoe --node-directory=NODEDIR start
        # --TWISTD-OPTIONS' also isn't allowed, unfortunately.

        BasedirOptions.parseArgs(self, basedir)
        self.twistd_args = twistd_args
Beispiel #5
0
    def parseArgs(self, basedir=None, *twistd_args):
        # This can't handle e.g. 'tahoe run --reactor=foo', since
        # '--reactor=foo' looks like an option to the tahoe subcommand, not to
        # twistd. So you can either use 'tahoe run' or 'tahoe run NODEDIR
        # --TWISTD-OPTIONS'. Note that 'tahoe --node-directory=NODEDIR run
        # --TWISTD-OPTIONS' also isn't allowed, unfortunately.

        BasedirOptions.parseArgs(self, basedir)
        self.twistd_args = twistd_args
 def parseArgs(self, alias, nickname=None):
     BasedirOptions.parseArgs(self)
     alias = argv_to_unicode(alias)
     if not alias.endswith(u':'):
         raise usage.UsageError("An alias must end with a ':' character.")
     self.alias = alias[:-1]
     self.nickname = argv_to_unicode(nickname)
     node_url_file = os.path.join(self['node-directory'], u"node.url")
     self['node-url'] = open(node_url_file, "r").read().strip()
     aliases = get_aliases(self['node-directory'])
     self.aliases = aliases
Beispiel #7
0
 def parseArgs(self):
     BasedirOptions.parseArgs(self)
     node_url_file = os.path.join(self['node-directory'], u"node.url")
     try:
         with open(node_url_file, "r") as f:
             self['node-url'] = f.read().strip()
     except EnvironmentError as e:
         raise usage.UsageError(
             "Could not read node url from {!r}: {!r}".format(
                 node_url_file,
                 e,
             ))
    def parseArgs(self, invite_code, local_dir):
        BasedirOptions.parseArgs(self)

        try:
            if int(self['poll-interval']) <= 0:
                raise ValueError("should be positive")
        except ValueError:
            raise usage.UsageError(
                "--poll-interval must be a positive integer")
        # Expand the path relative to the current directory of the CLI command, not the node.
        self.local_dir = None if local_dir is None else argv_to_abspath(
            local_dir, long_path=False)
        self.invite_code = to_str(argv_to_unicode(invite_code))
Beispiel #9
0
    def getUsage(self, width=None):
        t = BasedirOptions.getUsage(self, width) + "\n"
        twistd_options = str(MyTwistdConfig()).partition("\n")[2].partition("\n\n")[0]
        t += twistd_options.replace("Options:", "twistd-options:", 1)
        t += """

Note that if any twistd-options are used, NODEDIR must be specified explicitly
(not by default or using -C/--basedir or -d/--node-directory), and followed by
the twistd-options.
"""
        return t
Beispiel #10
0
    def getUsage(self, width=None):
        t = BasedirOptions.getUsage(self, width) + "\n"
        twistd_options = str(MyTwistdConfig()).partition("\n")[2].partition("\n\n")[0]
        t += twistd_options.replace("Options:", "twistd-options:", 1)
        t += """

Note that if any twistd-options are used, NODEDIR must be specified explicitly
(not by default or using -C/--basedir or -d/--node-directory), and followed by
the twistd-options.
"""
        return t
Beispiel #11
0
 def getUsage(self, width=None):
     t = BasedirOptions.getUsage(self, width)
     t += (
         "The crawler data is now stored as JSON to avoid"
         " potential security issues with pickle files.\n\nIf"
         " you are confident the state files in the 'storage/'"
         " subdirectory of your node are trustworthy, run this"
         " command to upgrade them to JSON.\n\nThe files are:"
         " lease_checker.history, lease_checker.state, and"
         " bucket_counter.state"
     )
     return t
Beispiel #12
0
    def parseArgs(self, alias, nickname=None, local_dir=None):
        BasedirOptions.parseArgs(self)
        alias = argv_to_unicode(alias)
        if not alias.endswith(u':'):
            raise usage.UsageError("An alias must end with a ':' character.")
        self.alias = alias[:-1]
        self.nickname = None if nickname is None else argv_to_unicode(nickname)
        try:
            if int(self['poll-interval']) <= 0:
                raise ValueError("should be positive")
        except ValueError:
            raise usage.UsageError(
                "--poll-interval must be a positive integer")

        # Expand the path relative to the current directory of the CLI command, not the node.
        self.local_dir = None if local_dir is None else argv_to_abspath(
            local_dir, long_path=False)

        if self.nickname and not self.local_dir:
            raise usage.UsageError(
                "If NICKNAME is specified then LOCAL_DIR must also be specified."
            )
        node_url_file = os.path.join(self['node-directory'], u"node.url")
        self['node-url'] = fileutil.read(node_url_file).strip()
Beispiel #13
0
 def parseArgs(self, basedir=None):
     BasedirOptions.parseArgs(self, basedir)
 def parseArgs(self, basedir=None):
     BasedirOptions.parseArgs(self, basedir)
Beispiel #15
0
 def parseArgs(self):
     BasedirOptions.parseArgs(self)
     node_url_file = os.path.join(self['node-directory'], u"node.url")
     with open(node_url_file, "r") as f:
         self['node-url'] = f.read().strip()