diff options
author | Mark McLoughlin <markmc@redhat.com> | 2012-11-04 21:32:45 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2012-11-04 21:46:35 +0000 |
commit | 637e805634b5179ffacad57ee26d4175449537f5 (patch) | |
tree | c0ff2f32d3f2957ae7b96a2eedc35b0029917048 /nova/policy.py | |
parent | 8ce58defbe560b1da34d991b38ac64a9b4c8d654 (diff) | |
download | nova-637e805634b5179ffacad57ee26d4175449537f5.tar.gz |
Switch from FLAGS to CONF in misc modules
Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.
We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.
Change-Id: Ib110ba8d1837780e90b0d3fe13f8e6b68ed15f65
Diffstat (limited to 'nova/policy.py')
-rw-r--r-- | nova/policy.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/nova/policy.py b/nova/policy.py index c9555fbf7a..9506635e90 100644 --- a/nova/policy.py +++ b/nova/policy.py @@ -19,6 +19,7 @@ import os.path +from nova import config from nova import exception from nova import flags from nova.openstack.common import cfg @@ -35,8 +36,8 @@ policy_opts = [ help=_('Rule checked when requested rule is not found')), ] -FLAGS = flags.FLAGS -FLAGS.register_opts(policy_opts) +CONF = config.CONF +CONF.register_opts(policy_opts) _POLICY_PATH = None _POLICY_CACHE = {} @@ -54,17 +55,17 @@ def init(): global _POLICY_PATH global _POLICY_CACHE if not _POLICY_PATH: - _POLICY_PATH = FLAGS.policy_file + _POLICY_PATH = CONF.policy_file if not os.path.exists(_POLICY_PATH): - _POLICY_PATH = FLAGS.find_file(_POLICY_PATH) + _POLICY_PATH = CONF.find_file(_POLICY_PATH) if not _POLICY_PATH: - raise exception.ConfigNotFound(path=FLAGS.policy_file) + raise exception.ConfigNotFound(path=CONF.policy_file) utils.read_cached_file(_POLICY_PATH, _POLICY_CACHE, reload_func=_set_rules) def _set_rules(data): - default_rule = FLAGS.policy_default_rule + default_rule = CONF.policy_default_rule policy.set_rules(policy.Rules.load_json(data, default_rule)) |