The osc_lib.shell Module

The osc_lib.shell Module

Command-line interface to the OpenStack APIs

class osc_lib.shell.OpenStackShell(description=None, version=None, command_manager=None, stdin=None, stdout=None, stderr=None, interactive_app_factory=None, deferred_help=False)

Bases: cliff.app.App

CONSOLE_MESSAGE_FORMAT = '%(levelname)s: %(name)s %(message)s'
build_option_parser(description, version)

Return an argparse option parser for this application.

Subclasses may override this method to extend the parser with more global options.

Parameters:
  • description (str) – full description of the application
  • version (str) – version number for the application
  • argparse_kwargs – extra keyword argument passed to the ArgumentParser constructor
clean_up(cmd, result, err)

Hook run after a command is done to shutdown the app.

Parameters:
  • cmd (cliff.command.Command) – command processor being invoked
  • result (int) – return value of cmd
  • err (Exception) – exception or None
close_profile()
configure_logging()

Configure logging for the app.

init_profile()
initialize_app(argv)

Global app init bits:

  • set up API versions
  • validate authentication info
  • authenticate against Identity if requested
interact()
log = <logging.Logger object>
prepare_to_run_command(cmd)

Set up auth and API versions

run(argv)

Equivalent to the main program for the application.

Parameters:argv (list of str) – input arguments and options
run_subcommand(argv)
timing_data = []
osc_lib.shell.main(argv=None)
osc_lib.shell.prompt_for_password(prompt=None)

Prompt user for a password

Prompt for a password if stdin is a tty.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.