tests: Disable policy deprecation warnings
Change-Id: I8d2710ac7275916bedf186131e5b0f88743c37c1 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
34979553e7
commit
92fb44ce72
@ -37,12 +37,28 @@ def reset():
|
|||||||
ENFORCER = None
|
ENFORCER = None
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init(suppress_deprecation_warnings=False):
|
||||||
|
"""Init an Enforcer class.
|
||||||
|
|
||||||
|
:param suppress_deprecation_warnings: Whether to suppress the deprecation
|
||||||
|
warnings.
|
||||||
|
"""
|
||||||
global ENFORCER
|
global ENFORCER
|
||||||
global saved_file_rules
|
global saved_file_rules
|
||||||
|
|
||||||
if not ENFORCER:
|
if not ENFORCER:
|
||||||
ENFORCER = policy.Enforcer(CONF)
|
ENFORCER = policy.Enforcer(CONF)
|
||||||
|
|
||||||
|
# NOTE(gmann): Explictly disable the warnings for policies
|
||||||
|
# changing their default check_str. During policy-defaults-refresh
|
||||||
|
# work, all the policy defaults have been changed and warning for
|
||||||
|
# each policy started filling the logs limit for various tool.
|
||||||
|
# Once we move to new defaults only world then we can enable these
|
||||||
|
# warning again.
|
||||||
|
ENFORCER.suppress_default_change_warnings = True
|
||||||
|
if suppress_deprecation_warnings:
|
||||||
|
ENFORCER.suppress_deprecation_warnings = True
|
||||||
|
|
||||||
register_rules(ENFORCER)
|
register_rules(ENFORCER)
|
||||||
ENFORCER.load_rules()
|
ENFORCER.load_rules()
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ TEST_VAR_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
|||||||
|
|
||||||
CONF = config.new_config()
|
CONF = config.new_config()
|
||||||
|
|
||||||
policy.init()
|
policy.init(suppress_deprecation_warnings=True)
|
||||||
ENFORCER = policy.ENFORCER
|
ENFORCER = policy.ENFORCER
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user