api: add auth_mode option
Change-Id: Ia1424ccd45c40c5187e1adf83d9e5e17d660a4e4
This commit is contained in:
parent
87ec850a29
commit
260bd26d79
|
@ -20,6 +20,10 @@ OPTS = [
|
|||
cfg.StrOpt('paste_config',
|
||||
default="api_paste.ini",
|
||||
help="Configuration file for WSGI definition of API."),
|
||||
cfg.StrOpt(
|
||||
'auth_mode',
|
||||
default="keystone",
|
||||
help="Authentication mode to use. Unset to disable authentication"),
|
||||
cfg.BoolOpt('enable_combination_alarms',
|
||||
default=False,
|
||||
help="Enable deprecated combination alarms.",
|
||||
|
|
|
@ -54,7 +54,7 @@ def setup_app(root, conf):
|
|||
)
|
||||
|
||||
|
||||
def load_app(conf, appname="aodh+keystone"):
|
||||
def load_app(conf):
|
||||
global APPCONFIGS
|
||||
|
||||
# Build the WSGI app
|
||||
|
@ -71,7 +71,10 @@ def load_app(conf, appname="aodh+keystone"):
|
|||
|
||||
LOG.info(_LI("WSGI config used: %s"), cfg_path)
|
||||
return deploy.loadapp("config:" + cfg_path,
|
||||
name=appname,
|
||||
name="aodh+" + (
|
||||
conf.api.auth_mode
|
||||
if conf.api.auth_mode else "noauth"
|
||||
),
|
||||
global_conf={'configkey': configkey})
|
||||
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ class FunctionalTest(db_test_base.TestBase):
|
|||
self.CONF.set_override('paste_config',
|
||||
os.path.abspath('etc/aodh/api_paste.ini'),
|
||||
group='api', enforce_type=True)
|
||||
self.app = webtest.TestApp(app.load_app(
|
||||
self.CONF, appname='aodh+noauth'))
|
||||
self.CONF.set_override('auth_mode', None, group='api')
|
||||
self.app = webtest.TestApp(app.load_app(self.CONF))
|
||||
|
||||
def put_json(self, path, params, expect_errors=False, headers=None,
|
||||
extra_environ=None, status=None):
|
||||
|
|
|
@ -392,8 +392,8 @@ class TestAlarms(TestAlarmsBase):
|
|||
pf = os.path.abspath('aodh/tests/functional/api/v2/policy.json-test')
|
||||
self.CONF.set_override('policy_file', pf, group='oslo_policy',
|
||||
enforce_type=True)
|
||||
self.app = webtest.TestApp(app.load_app(
|
||||
self.CONF, appname='aodh+noauth'))
|
||||
self.CONF.set_override('auth_mode', None, group='api')
|
||||
self.app = webtest.TestApp(app.load_app(self.CONF))
|
||||
|
||||
response = self.get_json('/alarms',
|
||||
expect_errors=True,
|
||||
|
|
|
@ -86,6 +86,7 @@ class ConfigFixture(fixture.GabbiFixture):
|
|||
os.path.abspath('etc/aodh/api_paste.ini'),
|
||||
group='api',
|
||||
)
|
||||
conf.set_override('auth_mode', None, group='api')
|
||||
|
||||
parsed_url = urlparse.urlparse(db_url)
|
||||
if parsed_url.scheme != 'sqlite':
|
||||
|
@ -105,7 +106,6 @@ class ConfigFixture(fixture.GabbiFixture):
|
|||
|
||||
LOAD_APP_KWARGS = {
|
||||
'conf': conf,
|
||||
'appname': 'aodh+noauth',
|
||||
}
|
||||
|
||||
def stop_fixture(self):
|
||||
|
|
Loading…
Reference in New Issue