Skip to content

Commit a2d25f4

Browse files
committed
Use oslo policy flag to disable default change warning instead of all
oslo has new flag to disable the warning for default check_str change and keep logging warning if policy name is changed or it is marked for removal. Policy defaults refresh BP work changed the defaults for all the policy so logging their warning is dangerousa and fill up the log file. Once we switch to new defaults then we can enable them if needed. Logging warning for name change and marked for removal make sense when old rules are override by operator so the new flag does not control those. For policy defaults refresh BP work, we do not have many policies in this category so logging their warning is ok. This commits reset the testing flag 'suppress_deprecation_warnings' default value back to False. Test policy fixture sets that to True to avoid any warnig during tests run. Bumping the oslo policy version where this new flag is present - https://review.opendev.org/#/c/719547/ Partial implement blueprint policy-defaults-refresh Change-Id: Iaa6baf6877890babb6205bdb3ee2e1a2b28ebd9c
1 parent 86655fe commit a2d25f4

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

lower-constraints.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ oslo.i18n==3.15.3
8080
oslo.log==3.36.0
8181
oslo.messaging==10.3.0
8282
oslo.middleware==3.31.0
83-
oslo.policy==2.3.0
83+
oslo.policy==3.1.0
8484
oslo.privsep==1.33.2
8585
oslo.reports==1.18.0
8686
oslo.rootwrap==5.8.0

nova/policy.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ def reset():
4949
_ENFORCER = None
5050

5151

52-
# TODO(gmann): Make suppress_deprecation_warnings default to False, once
53-
# we find the way to disable warning for default change on oslo side.
5452
def init(policy_file=None, rules=None, default_rule=None, use_conf=True,
55-
suppress_deprecation_warnings=True):
53+
suppress_deprecation_warnings=False):
5654
"""Init an Enforcer class.
5755
5856
:param policy_file: Custom policy file to use, if none is specified,
@@ -75,6 +73,13 @@ def init(policy_file=None, rules=None, default_rule=None, use_conf=True,
7573
rules=rules,
7674
default_rule=default_rule,
7775
use_conf=use_conf)
76+
# NOTE(gmann): Explictly disable the warnings for policies
77+
# changing their default check_str. During policy-defaults-refresh
78+
# work, all the policy defaults have been changed and warning for
79+
# each policy started filling the logs limit for various tool.
80+
# Once we move to new defaults only world then we can enable these
81+
# warning again.
82+
_ENFORCER.suppress_default_change_warnings = True
7883
if suppress_deprecation_warnings:
7984
_ENFORCER.suppress_deprecation_warnings = True
8085
register_rules(_ENFORCER)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ oslo.utils>=4.1.0 # Apache-2.0
4545
oslo.db>=4.44.0 # Apache-2.0
4646
oslo.rootwrap>=5.8.0 # Apache-2.0
4747
oslo.messaging>=10.3.0 # Apache-2.0
48-
oslo.policy>=2.3.0 # Apache-2.0
48+
oslo.policy>=3.1.0 # Apache-2.0
4949
oslo.privsep>=1.33.2 # Apache-2.0
5050
oslo.i18n>=3.15.3 # Apache-2.0
5151
oslo.service>=1.40.1 # Apache-2.0

0 commit comments

Comments
 (0)