Primary Maintainer¶
- Primary Maintainer:
Unknown
- Other Contributors:
None
https://blueprints.launchpad.net/oslo-incubator/+spec/graduate-oslo-context
oslo.context holds the context base class, which defines APIs used by oslo.messaging and oslo.log.
What is the name of the new library?: oslo.context
openstack/common/context.py
tests/unit/test_context.py
oslo.log
oslo.messaging
import oslo_context
All of the existing public functions and classes will remain public.
def generate_request_id():
"Return a unique request identifier."
class RequestContext(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.
"""
def get_admin_context(show_deleted=False):
"Return a RequestContext configured as an admin user"
def 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.
"""
def is_user_context(context):
"""Indicates if the request context is a normal user."""
A private registry of context objects will be kept using a threading.local() instance and logic based on nova.context.RequestContext. A new public API for accessing the context will be added:
def get_current():
"Return this thread's current context"
doug-hellmann
None
Unknown
None
doug-hellmann
Target Milestone for completion: kilo-1
https://wiki.openstack.org/wiki/Oslo/CreatingANewLibrary#Checklist
Add registry management logic.
We will evolve the API for RequestContext after exporting it, based on needs for oslo.messaging and oslo.log. Those changes have not yet been worked out, and will come in another spec.
Projects using oslo.context should subclass oslo_context.RequestContext and create their own application-specific context class.
None
https://etherpad.openstack.org/p/kilo-oslo-library-proposals
https://blueprints.launchpad.net/oslo.log/+spec/remove-context-adapter
https://blueprints.launchpad.net/oslo.log/+spec/app-agnostic-logging-parameters
Note
This work is licensed under a Creative Commons Attribution 3.0 Unported License. http://creativecommons.org/licenses/by/3.0/legalcode
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.