Command Line Interface

bigchaindb.commands.bigchaindb

Implementation of the bigchaindb command, the command-line interface (CLI) for BigchainDB Server.

bigchaindb.commands.bigchaindb.run_show_config(args)[source]

Show the current configuration

bigchaindb.commands.bigchaindb.run_configure(args, skip_if_exists=False)[source]

Run a script to configure the current node.

Parameters:skip_if_exists (bool) – skip the function if a config file already exists
bigchaindb.commands.bigchaindb.run_export_my_pubkey(args)[source]

Export this node’s public key to standard output

bigchaindb.commands.bigchaindb.run_init(args)[source]

Initialize the database

bigchaindb.commands.bigchaindb.run_drop(args)[source]

Drop the database

bigchaindb.commands.bigchaindb.run_start(args)[source]

Start the processes to run the node

bigchaindb.commands.utils

Utility functions and basic common arguments for argparse.ArgumentParser.

bigchaindb.commands.utils.configure_bigchaindb(command)[source]

Decorator to be used by command line functions, such that the configuration of bigchaindb is performed before the execution of the command.

Parameters:command – The command to decorate.
Returns:The command wrapper function.
bigchaindb.commands.utils.start_logging_process(command)[source]

Decorator to start the logging subscriber process.

Parameters:command – The command to decorate.
Returns:The command wrapper function.

Important

Configuration, if needed, should be applied before invoking this decorator, as starting the subscriber process for logging will configure the root logger for the child process based on the state of bigchaindb.config at the moment this decorator is invoked.

bigchaindb.commands.utils.input_on_stderr(prompt='', default=None, convert=None)[source]

Output a string to stderr and wait for input.

Parameters:
  • prompt (str) – the message to display.
  • default – the default value to return if the user leaves the field empty
  • convert (callable) – a callable to be used to convert the value the user inserted. If None, the type of default will be used.
bigchaindb.commands.utils.start_rethinkdb()[source]

Start RethinkDB as a child process and wait for it to be available.

Raises::class:`~bigchaindb.common.exceptions.StartupError` if – RethinkDB cannot be started.
bigchaindb.commands.utils.start(parser, argv, scope)[source]

Utility function to execute a subcommand.

The function will look up in the scope if there is a function called run_<parser.args.command> and will run it using parser.args as first positional argument.

Parameters:
  • parser – an ArgumentParser instance.
  • argv – the list of command line arguments without the script name.
  • scope (dict) – map containing (eventually) the functions to be called.
Raises:

NotImplementedError – if scope doesn’t contain a function called run_<parser.args.command>.

bigchaindb.commands.utils.mongodb_host(host)[source]

Utility function that works as a type for mongodb host args.

This function validates the host args provided by to the add-replicas and remove-replicas commands and checks if each arg is in the form “host:port”

Parameters:host (str) – A string containing hostname and port (e.g. “host:port”)
Raises:ArgumentTypeError – if it fails to parse the argument