osc_lib package

osc_lib package

Submodules

osc_lib.clientmanager module

Manage access to the clients, including authenticating when needed.

class osc_lib.clientmanager.ClientCache(factory)

Bases: object

Descriptor class for caching created client handles.

class osc_lib.clientmanager.ClientManager(cli_options=None, api_version=None, pw_func=None, app_name=None, app_version=None)

Bases: object

Manages access to API clients, including authentication.

auth_ref

Dereference will trigger an auth if it hasn’t already

get_configuration()
get_endpoint_for_service_type(service_type, region_name=None, interface='public')

Return the endpoint URL for the service type.

is_service_available(service_type)

Check if a service type is in the current Service Catalog

setup_auth()

Set up authentication

This is deferred until authentication is actually attempted because it gets in the way of things that do not require auth.

validate_scope()

osc_lib.exceptions module

Exception definitions.

exception osc_lib.exceptions.AuthorizationFailure

Bases: exceptions.Exception

exception osc_lib.exceptions.BadRequest(code, message=None, details=None)

Bases: osc_lib.exceptions.ClientException

HTTP 400 - Bad request: you sent some malformed data.

http_status = 400
message = 'Bad request'
exception osc_lib.exceptions.ClientException(code, message=None, details=None)

Bases: exceptions.Exception

The base exception class for all exceptions this library raises.

exception osc_lib.exceptions.CommandError

Bases: exceptions.Exception

exception osc_lib.exceptions.Conflict(code, message=None, details=None)

Bases: osc_lib.exceptions.ClientException

HTTP 409 - Conflict

http_status = 409
message = 'Conflict'
exception osc_lib.exceptions.EndpointNotFound

Bases: exceptions.Exception

Could not find Service or Region in Service Catalog.

exception osc_lib.exceptions.Forbidden(code, message=None, details=None)

Bases: osc_lib.exceptions.ClientException

HTTP 403 - Forbidden: not authorized to access to this resource.

http_status = 403
message = 'Forbidden'
exception osc_lib.exceptions.HTTPNotImplemented(code, message=None, details=None)

Bases: osc_lib.exceptions.ClientException

HTTP 501 - Not Implemented: server does not support this operation.

http_status = 501
message = 'Not Implemented'
exception osc_lib.exceptions.InvalidValue

Bases: exceptions.Exception

An argument value is not valid: wrong type, out of range, etc

message = 'Supplied value is not valid'
exception osc_lib.exceptions.NoTokenLookupException

Bases: exceptions.Exception

This does not support looking up endpoints from an existing token.

exception osc_lib.exceptions.NotFound(code, message=None, details=None)

Bases: osc_lib.exceptions.ClientException

HTTP 404 - Not found

http_status = 404
message = 'Not found'
exception osc_lib.exceptions.OverLimit(code, message=None, details=None)

Bases: osc_lib.exceptions.ClientException

HTTP 413 - Over limit: reached the API limits for this time period.

http_status = 413
message = 'Over limit'
exception osc_lib.exceptions.PluginAttributeError

Bases: exceptions.Exception

A plugin threw an AttributeError while being lazily loaded.

exception osc_lib.exceptions.Unauthorized(code, message=None, details=None)

Bases: osc_lib.exceptions.ClientException

HTTP 401 - Unauthorized: bad credentials.

http_status = 401
message = 'Unauthorized'
exception osc_lib.exceptions.UnsupportedVersion

Bases: exceptions.Exception

The user is trying to use an unsupported version of the API

osc_lib.i18n module

osc_lib.logs module

Application logging

class osc_lib.logs.LogConfigurator(options)

Bases: object

configure(cloud_config)
osc_lib.logs.get_loggers()
osc_lib.logs.log_level_from_config(config)
osc_lib.logs.log_level_from_options(options)
osc_lib.logs.log_level_from_string(level_string)
osc_lib.logs.set_warning_filter(log_level)

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.

osc_lib.version module

Module contents

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.