From c81135cf0fb977a475db7574a9b97f5a49687466 Mon Sep 17 00:00:00 2001
From: Ghanshyam Mann <gmann@ghanshyammann.com>
Date: Sun, 10 Nov 2024 21:38:19 -0800
Subject: [PATCH] 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: I3e3d0aaaece99120d276ff44dcdb3151855c8fe5
---
 cinder/common/config.py | 4 +---
 cinder/policy.py        | 3 ---
 requirements.txt        | 2 +-
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/cinder/common/config.py b/cinder/common/config.py
index a682dac5fd3..370253878a2 100644
--- a/cinder/common/config.py
+++ b/cinder/common/config.py
@@ -33,8 +33,6 @@ from oslo_middleware import cors
 from oslo_policy import opts as policy_opts
 from oslo_utils import netutils
 
-from cinder.policy import DEFAULT_POLICY_FILENAME
-
 
 CONF = cfg.CONF
 logging.register_options(CONF)
@@ -257,6 +255,6 @@ def set_external_library_defaults():
     # setup.cfg.
 
     set_middleware_defaults()
-    policy_opts.set_defaults(CONF, policy_file=DEFAULT_POLICY_FILENAME,
+    policy_opts.set_defaults(CONF,
                              enforce_scope=False,
                              enforce_new_defaults=False)
diff --git a/cinder/policy.py b/cinder/policy.py
index 503e1be4231..54df7d40939 100644
--- a/cinder/policy.py
+++ b/cinder/policy.py
@@ -33,14 +33,11 @@ from cinder import policies
 CONF = cfg.CONF
 LOG = logging.getLogger(__name__)
 # TODO(gmann): Remove overriding the default value of config options:
-# - 'policy_file' once oslo_policy change their default value to what is
-# overridden here.
 # - 'enforce_scope', and 'enforce_new_defaults' once cinder is ready with the
 # new RBAC (oslo_policy enable them by default)
 DEFAULT_POLICY_FILENAME = 'policy.yaml'
 policy_opts.set_defaults(
     cfg.CONF,
-    DEFAULT_POLICY_FILENAME,
     enforce_scope=False,
     enforce_new_defaults=False)
 
diff --git a/requirements.txt b/requirements.txt
index 2e342031fa1..5ebef2ac304 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,7 +19,7 @@ oslo.db>=11.0.0 # Apache-2.0
 oslo.log>=4.6.1 # Apache-2.0
 oslo.messaging>=14.1.0 # Apache-2.0
 oslo.middleware>=4.1.1 # Apache-2.0
-oslo.policy>=3.11.0 # Apache-2.0
+oslo.policy>=4.5.0 # Apache-2.0
 oslo.privsep>=2.6.2 # Apache-2.0
 oslo.reports>=3.2.0 # Apache-2.0
 oslo.rootwrap>=6.2.0 # Apache-2.0