oslo.policy/doc/source/usage.rst
Steve Martinelli 794aaca6ea document the migration process and update the docs a bit
stylize the docs, and document the migration process, specifically
calling out the changes to the Enforcer class, which now required
an oslo.config config object to be passed in.

implements bp graduate-policy

Change-Id: Ief4395f3312b90adea1f05903b9498b730663a74
2015-02-11 12:23:49 -05:00

1009 B

Usage

To use oslo.policy in a project, import the relevant module. For example:

from oslo_policy import policy

Migrating to oslo.policy

Applications using the incubated version of the policy code from Oslo aside from changing the way the library is imported, may need to make some extra changes.

Changes to Enforcer Initialization

The oslo.policy library no longer assumes a global configuration object is available. Instead the :pyoslo_policy.policy.Enforcer class has been changed to expect the consuming application to pass in an oslo.config configuration object.

When using policy from oslo-incubator

enforcer = policy.Enforcer(policy_file=_POLICY_PATH)

When using oslo.policy

from keystone import config
CONF = config.CONF
enforcer = policy.Enforcer(CONF, policy_file=_POLICY_PATH)