keystone.openstack.common package

Submodules

keystone.openstack.common.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, domain=None, user_domain=None, project_domain=None, is_admin=False, read_only=False, show_deleted=False, request_id=None, instance_uuid=None)[source]

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()[source]
user_idt_format = '{user} {tenant} {domain} {user_domain} {p_domain}'
keystone.openstack.common.context.generate_request_id()[source]
keystone.openstack.common.context.get_admin_context(show_deleted=False)[source]
keystone.openstack.common.context.get_context_from_function_and_args(function, args, kwargs)[source]

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.

keystone.openstack.common.eventlet_backdoor module

keystone.openstack.common.exception module

keystone.openstack.common.excutils module

keystone.openstack.common.fileutils module

keystone.openstack.common.gettextutils module

keystone.openstack.common.importutils module

Import related utilities and helper functions.

keystone.openstack.common.importutils.import_class(import_str)[source]

Returns a class from a string including module and class.

keystone.openstack.common.importutils.import_module(import_str)[source]

Import a module.

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

Import a class and return an instance of it.

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

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)[source]

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

keystone.openstack.common.jsonutils module

keystone.openstack.common.local module

Local storage of variables using weak references

class keystone.openstack.common.local.WeakLocal[source]

Bases: thread._local

keystone.openstack.common.lockutils module

keystone.openstack.common.log module

keystone.openstack.common.loopingcall module

keystone.openstack.common.network_utils module

Network-related utilities and helper functions.

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

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)[source]

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.

keystone.openstack.common.policy module

keystone.openstack.common.processutils module

keystone.openstack.common.service module

keystone.openstack.common.strutils module

keystone.openstack.common.systemd module

keystone.openstack.common.test module

keystone.openstack.common.threadgroup module

keystone.openstack.common.timeutils module

keystone.openstack.common.uuidutils module

UUID related utilities and helper functions.

keystone.openstack.common.uuidutils.generate_uuid()[source]
keystone.openstack.common.uuidutils.is_uuid_like(val)[source]

Returns validation of a value as a UUID.

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

keystone.openstack.common.versionutils module

Module contents