From 69561af93f17f19e490681c83a4d20434c81d10d Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 23 Jun 2017 14:04:05 -0400 Subject: [PATCH] Add PBR wsgi_scripts entrypoint for barbican api This commit makes the barbican wsgi script consistent with other services by leveraging the pbr wsgi_scripts entrypoint to expose it. While you could still leverage the bundled app.wsgi the entrypoint barbican's behavior the same as other services. As part of this the app.wsgi script is deprecated and will be removed in the future. Change-Id: Id42f76dbfd59209232b37096a708ee18cbf96431 --- barbican/api/app.py | 7 +++++++ barbican/api/app.wsgi | 9 +++++---- setup.cfg | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/barbican/api/app.py b/barbican/api/app.py index 4a9dfac6..0448c6ab 100644 --- a/barbican/api/app.py +++ b/barbican/api/app.py @@ -18,6 +18,7 @@ API application handler for Barbican """ import os +from paste import deploy import pecan try: @@ -101,3 +102,9 @@ def create_main_app(global_config, **local_conf): def create_version_app(global_config, **local_conf): wsgi_app = pecan.make_app(versions.VersionsController()) return wsgi_app + + +def get_api_wsgi_script(): + conf = '/etc/barbican/barbican-api-paste.ini' + application = deploy.loadapp('config:%s' % conf) + return application diff --git a/barbican/api/app.wsgi b/barbican/api/app.wsgi index 6c506cbc..362a0868 100644 --- a/barbican/api/app.wsgi +++ b/barbican/api/app.wsgi @@ -16,10 +16,11 @@ """Use this file for deploying the API under mod_wsgi. See http://pecan.readthedocs.org/en/latest/deployment.html for details. + +NOTE(mtreinish): This wsgi script is deprecated since the wsgi app is now +exposed as an entrypoint via barbican-wsgi-api """ -from paste import deploy - -conf = '/etc/barbican/barbican-api-paste.ini' -application = deploy.loadapp('config:%s' % conf) +from barbican.api import app +application = app.get_api_wsgi_script() diff --git a/setup.cfg b/setup.cfg index d0f81c52..150127a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,6 +40,9 @@ console_scripts = pkcs11-key-generation = barbican.cmd.pkcs11_key_generation:main barbican-retry = barbican.cmd.retry_scheduler:main +wsgi_scripts = + barbican-wsgi-api = barbican.api.app:get_api_wsgi_script + barbican.secretstore.plugin = store_crypto = barbican.plugin.store_crypto:StoreCryptoAdapterPlugin dogtag_crypto = barbican.plugin.dogtag:DogtagKRAPlugin