ironic.common.context module

class ironic.common.context.RequestContext(is_public_api=False, auth_token_info=None, **kwargs)[source]

Bases: RequestContext

Extends security contexts from the oslo.context library.

FROM_DICT_EXTRA_KEYS: ty.List[str] = ['auth_token_info']

Ensure threading contains context

For async/periodic tasks, the context of local thread is missing. Set it with request context and this is useful to log the request_id in log messages.

classmethod from_environ(environ, **kwargs)[source]

Load a context object from a request environment.

If keyword arguments are provided then they override the values in the request environment, injecting the kwarg arguments used by ironic, as unknown values are filtered out from the final context object in the base oslo.context library.


environ (dict) – The environment dictionary associated with a request.


Return a dictionary of context attributes.


A dictionary of context attributes to enforce policy with.

oslo.policy enforcement requires a dictionary of attributes representing the current logged in user on which it applies policy enforcement. This dictionary defines a standard list of attributes that should be available for enforcement across services.

It is expected that services will often have to override this method with either deprecated values or additional attributes used by that service specific policy.


Create an administrator context.