Merge "placement: ignore policy scope check failures if not enforcing scope"

This commit is contained in:
Zuul 2018-08-14 09:19:14 +00:00 committed by Gerrit Code Review
commit 61f854ff64
2 changed files with 12 additions and 0 deletions

View File

@ -81,6 +81,13 @@ def deploy(conf):
if middleware:
application = middleware(application)
# NOTE(mriedem): Ignore scope check UserWarnings from oslo.policy.
if not conf.oslo_policy.enforce_scope:
import warnings
warnings.filterwarnings('ignore',
message="Policy .* failed scope check",
category=UserWarning)
return application

View File

@ -20,6 +20,7 @@ import os.path
from oslo_log import log as logging
from oslo_middleware import cors
from oslo_policy import opts as policy_opts
from oslo_utils import importutils
import pbr.version
@ -65,6 +66,10 @@ def _parse_args(argv, default_config_files):
_set_middleware_defaults()
# This is needed so we can check [oslo_policy]/enforce_scope in the
# deploy module.
policy_opts.set_defaults(conf.CONF)
conf.CONF(argv[1:], project='nova', version=version_info.version_string(),
default_config_files=default_config_files)