summaryrefslogtreecommitdiff
path: root/oslo_policy/generator.py
diff options
context:
space:
mode:
authorBen Nemec <bnemec@redhat.com>2019-09-13 17:08:05 +0000
committerBen Nemec <bnemec@redhat.com>2019-09-17 21:50:14 +0000
commit5d3aeb53a9f3686353e0740c1891bd0e66e90650 (patch)
tree60040d016240c0adb8711291ad244d063025aa65 /oslo_policy/generator.py
parente433a3cbec5da0241bb1716b8bfda9fa927069ce (diff)
downloadoslo-policy-5d3aeb53a9f3686353e0740c1891bd0e66e90650.tar.gz
Suppress deprecation warnings in oslopolicy-list-redundant
When running the tool against a project with a lot of deprecated policies, the deprecation warnings overwhelm the important output from the tool. Since checking for deprecations isn't the purpose of this tool, let's just suppress warnings and limit the output to the list of redundant policy rules that the user cares about. I will note that the suppress_deprecation_warnings member is marked as test only, but that was targeted at consumers of oslo.policy rather than oslo.policy itself. I could also argue that we're "testing" for redundant policies here, but that feels like semantic hair splitting. :-) Change-Id: I194af14ebd341366dbb1dd033654739a7f3d085c Partial-Bug: 1836568
Diffstat (limited to 'oslo_policy/generator.py')
-rw-r--r--oslo_policy/generator.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/oslo_policy/generator.py b/oslo_policy/generator.py
index bd75389..9e283d9 100644
--- a/oslo_policy/generator.py
+++ b/oslo_policy/generator.py
@@ -315,6 +315,11 @@ def _list_redundant(namespace):
in a policy file and operators should consider removing them.
"""
enforcer = _get_enforcer(namespace)
+ # NOTE(bnemec): We don't want to see policy deprecation warnings in the
+ # output of this tool. They tend to overwhelm the output that the user
+ # actually cares about, and checking for deprecations isn't the purpose of
+ # this tool.
+ enforcer.suppress_deprecation_warnings = True
# Ensure that files have been parsed
enforcer.load_rules()