common Package

context Module

Simple class that stores security context information in the web request.

Projects should subclass this class if they wish to enhance the request context or provide additional information in their specific WSGI pipeline.

class keystone.openstack.common.context.RequestContext(auth_token=None, user=None, tenant=None, is_admin=False, read_only=False, show_deleted=False, request_id=None)

Bases: object

Helper class to represent useful information about a request context.

Stores information about the security context under which the user accesses the system, as well as additional request information.

to_dict()
keystone.openstack.common.context.generate_request_id()
keystone.openstack.common.context.get_admin_context(show_deleted=False)
keystone.openstack.common.context.get_context_from_function_and_args(function, args, kwargs)

Find an arg of type RequestContext and return it.

This is useful in a couple of decorators where we don’t know much about the function we’re wrapping.

eventlet_backdoor Module

exception Module

excutils Module

fileutils Module

gettextutils Module

importutils Module

Import related utilities and helper functions.

keystone.openstack.common.importutils.import_class(import_str)

Returns a class from a string including module and class.

keystone.openstack.common.importutils.import_module(import_str)

Import a module.

keystone.openstack.common.importutils.import_object(import_str, *args, **kwargs)

Import a class and return an instance of it.

keystone.openstack.common.importutils.import_object_ns(name_space, import_str, *args, **kwargs)

Tries to import object from default namespace.

Imports a class and return an instance of it, first by trying to find the class in a default namespace, then failing back to a full path if not found in the default namespace.

keystone.openstack.common.importutils.try_import(import_str, default=None)

Try to import a module and if it fails return default.

jsonutils Module

local Module

Local storage of variables using weak references

class keystone.openstack.common.local.WeakLocal

Bases: thread._local

lockutils Module

log Module

log_handler Module

loopingcall Module

network_utils Module

Network-related utilities and helper functions.

keystone.openstack.common.network_utils.parse_host_port(address, default_port=None)

Interpret a string as a host:port pair.

An IPv6 address MUST be escaped if accompanied by a port, because otherwise ambiguity ensues: 2001:db8:85a3::8a2e:370:7334 means both [2001:db8:85a3::8a2e:370:7334] and [2001:db8:85a3::8a2e:370]:7334.

>>> parse_host_port('server01:80')
('server01', 80)
>>> parse_host_port('server01')
('server01', None)
>>> parse_host_port('server01', default_port=1234)
('server01', 1234)
>>> parse_host_port('[::1]:80')
('::1', 80)
>>> parse_host_port('[::1]')
('::1', None)
>>> parse_host_port('[::1]', default_port=1234)
('::1', 1234)
>>> parse_host_port('2001:db8:85a3::8a2e:370:7334', default_port=1234)
('2001:db8:85a3::8a2e:370:7334', 1234)
keystone.openstack.common.network_utils.urlsplit(url, scheme='', allow_fragments=True)

Parse a URL using urlparse.urlsplit(), splitting query and fragments. This function papers over Python issue9374 when needed.

The parameters are the same as urlparse.urlsplit.

policy Module

service Module

sslutils Module

strutils Module

threadgroup Module

timeutils Module

uuidutils Module

UUID related utilities and helper functions.

keystone.openstack.common.uuidutils.generate_uuid()
keystone.openstack.common.uuidutils.is_uuid_like(val)

Returns validation of a value as a UUID.

For our purposes, a UUID is a canonical form string: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa