diff options
author | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2012-08-02 13:12:18 -0500 |
---|---|---|
committer | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2012-08-02 13:26:27 -0500 |
commit | 751270fd4618fe054d767159eb2373583a63742c (patch) | |
tree | ff624701630613b129faa04161a48c08aea1d84f /nova/policy.py | |
parent | 8583ce6bc0a6184c7f866bfd1ebfa7443da4b5f6 (diff) | |
download | nova-751270fd4618fe054d767159eb2373583a63742c.tar.gz |
Use function registration for policy checks
The original policy framework allowed new policy checks to be created
through inheritance. This is somewhat clunky and unnecessary in
Python. This change refactors policy.py to allow new policy checks
to be registered using an @register() decorator. One consequence is
that HttpBrain is deprecated.
Care has been taken to ensure backwards compatibility; deprecation
warnings will be emitted for uses of HttpBrain or the inheritance-
based checks.
(Pull-up from openstack-common, with deprecation of HttpBrain.)
Change-Id: Ia9a6039a82fe4ebfa9b18e5eb93c21fffee90f09
Diffstat (limited to 'nova/policy.py')
-rw-r--r-- | nova/policy.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nova/policy.py b/nova/policy.py index 8c501da9e5..94bbbdd937 100644 --- a/nova/policy.py +++ b/nova/policy.py @@ -65,7 +65,7 @@ def init(): def _set_brain(data): default_rule = FLAGS.policy_default_rule - policy.set_brain(policy.HttpBrain.load_json(data, default_rule)) + policy.set_brain(policy.Brain.load_json(data, default_rule)) def enforce(context, action, target): |