Remove default override for config options policy_file

olso.policy 4.5.0[1] changed the config options policy_file
default value to 'policy.yaml', which means it is changed
for all the OpenStack services and they do not need to
override the default anymore.

NOTE: There is no change in behaviour here, oslo.policy provides
the same configuration that services have overridden till now.

[1] https://review.opendev.org/c/openstack/releases/+/934012
[2] https://review.opendev.org/c/openstack/requirements/+/934295

Change-Id: Ia48842d0e0254bc2185716a3199ec7f810374f5d
This commit is contained in:
Ghanshyam Mann 2024-11-10 21:37:59 -08:00
parent 5167b21c60
commit 7eb5e2948c
4 changed files with 3 additions and 18 deletions

View File

@ -20,7 +20,6 @@ from collections import abc
from oslo_config import cfg
from oslo_log import log as logging
from oslo_policy import opts
from oslo_policy import policy
from glance.common import exception
@ -33,15 +32,6 @@ CONF = cfg.CONF
_ENFORCER = None
# TODO(gmann): Remove overriding the default value of config options
# 'policy_file' once oslo_policy changes its default value to what
# is overridden here.
DEFAULT_POLICY_FILE = 'policy.yaml'
opts.set_defaults(
cfg.CONF,
DEFAULT_POLICY_FILE)
class Enforcer(policy.Enforcer):
"""Responsible for loading and enforcing rules"""

View File

@ -22,7 +22,6 @@ import os
from oslo_config import cfg
from oslo_middleware import cors
from oslo_policy import opts
from paste import deploy
from glance.i18n import _
@ -745,12 +744,6 @@ def set_config_defaults():
"""This method updates all configuration default values."""
set_cors_middleware_defaults()
# TODO(gmann): Remove setting the default value of config policy_file
# once oslo_policy change the default value to 'policy.yaml'.
# https://github.com/openstack/oslo.policy/blob/a626ad12fe5a3abd49d70e3e5b95589d279ab578/oslo_policy/opts.py#L49
DEFAULT_POLICY_FILE = 'policy.yaml'
opts.set_defaults(cfg.CONF, DEFAULT_POLICY_FILE)
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""

View File

@ -37,6 +37,7 @@ from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_log.fixture import logging_error as log_fixture
from oslo_log import log
from oslo_policy import opts as opts
from oslo_utils import timeutils
from oslo_utils import units
import testtools
@ -104,6 +105,7 @@ class BaseTestCase(testtools.TestCase):
cached_images.WORKER = None
def set_policy(self):
opts.set_defaults(CONF)
conf_file = "policy.yaml"
self.policy_file = self._copy_data_file(conf_file, self.conf_dir)
self.config(policy_file=self.policy_file, group='oslo_policy')

View File

@ -35,7 +35,7 @@ oslo.log>=4.5.0 # Apache-2.0
oslo.messaging>=5.29.0,!=9.0.0 # Apache-2.0
oslo.middleware>=3.31.0 # Apache-2.0
oslo.reports>=1.18.0 # Apache-2.0
oslo.policy>=4.4.0 # Apache-2.0
oslo.policy>=4.5.0 # Apache-2.0
retrying!=1.3.0,>=1.2.3 # Apache-2.0
osprofiler>=1.4.0 # Apache-2.0