Make Diagnostics and Sync API's optional
Change-Id: I55ddaa72b95a4b79bee644d0cc6ba8216307a3e8
This commit is contained in:
parent
b4aa98bf32
commit
0092df7f8a
|
@ -52,6 +52,9 @@ default_log_levels = amqplib=WARN, sqlalchemy=WARN, boto=WARN, suds=INFO, keysto
|
|||
# Authentication strategy to use - can be either "noauth" or "keystone"
|
||||
#auth_strategy = noauth
|
||||
|
||||
# Enabled API Version 1 extensions
|
||||
#enabled_extensions_v1 = diagnostics, sync, import, export
|
||||
|
||||
#-----------------------
|
||||
# Agent Service
|
||||
#-----------------------
|
||||
|
|
|
@ -15,21 +15,36 @@
|
|||
# under the License.
|
||||
import flask
|
||||
from stevedore import extension
|
||||
from stevedore import named
|
||||
from moniker.openstack.common import cfg
|
||||
from moniker.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
cfg.CONF.register_opts([
|
||||
cfg.ListOpt('enabled-extensions-v1', default=[],
|
||||
help='Enabled API Extensions'),
|
||||
], group='service:api')
|
||||
|
||||
|
||||
def factory(global_config, **local_conf):
|
||||
app = flask.Flask('moniker.api.v1')
|
||||
|
||||
# TODO(kiall): Ideally, we want to make use of the Plugin class here.
|
||||
# This works for the moment though.
|
||||
mgr = extension.ExtensionManager('moniker.api.v1')
|
||||
|
||||
def _load_extension(ext):
|
||||
def _register_blueprint(ext):
|
||||
app.register_blueprint(ext.plugin)
|
||||
|
||||
mgr.map(_load_extension)
|
||||
# Add all in-built APIs
|
||||
mgr = extension.ExtensionManager('moniker.api.v1')
|
||||
mgr.map(_register_blueprint)
|
||||
|
||||
# Add any (enabled) optional extensions
|
||||
extensions = cfg.CONF['service:api'].enabled_extensions_v1
|
||||
|
||||
if len(extensions) > 0:
|
||||
extmgr = named.NamedExtensionManager('moniker.api.v1.extensions',
|
||||
names=extensions)
|
||||
extmgr.map(_register_blueprint)
|
||||
|
||||
return app
|
||||
|
|
6
setup.py
6
setup.py
|
@ -62,8 +62,10 @@ setup(
|
|||
records = moniker.api.v1.records:blueprint
|
||||
servers = moniker.api.v1.servers:blueprint
|
||||
tsigkeys = moniker.api.v1.tsigkeys:blueprint
|
||||
diagnostics = moniker.api.v1.diagnostics:blueprint
|
||||
sync = moniker.api.v1.sync:blueprint
|
||||
|
||||
[moniker.api.v1.extensions]
|
||||
diagnostics = moniker.api.v1.extensions.diagnostics:blueprint
|
||||
sync = moniker.api.v1.extensions.sync:blueprint
|
||||
|
||||
[moniker.storage]
|
||||
sqlalchemy = moniker.storage.impl_sqlalchemy:SQLAlchemyStorage
|
||||
|
|
Loading…
Reference in New Issue