Render api-paste.ini from charm

Due to misc bugs in the way older versions of the gnocchi packages
installed the api-paste.ini, this file is not treated as a dpkg
configuration file, and as a result @ Queens, the file from the
package is not installed over any previous version.

Include api-paste.ini as part of the charm to ensure that a good
paste configuration is installed for all Gnocchi releases.

Change-Id: I1362a64368f0df8e07c7d29d5b504edaf96a70de
Closes-Bug: 1781468
This commit is contained in:
James Page 2018-07-15 11:27:55 +01:00
parent 5884e56c18
commit 60678f23b1
4 changed files with 126 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import charms_openstack.ip as os_ip
GNOCCHI_DIR = '/etc/gnocchi'
GNOCCHI_CONF = os.path.join(GNOCCHI_DIR, 'gnocchi.conf')
GNOCCHI_API_PASTE = os.path.join(GNOCCHI_DIR, 'api-paste.ini')
GNOCCHI_WEBSERVER_SITE = 'gnocchi-api'
GNOCCHI_WSGI_CONF = '/etc/apache2/sites-available/{}.conf'.format(
GNOCCHI_WEBSERVER_SITE)
@ -213,6 +214,7 @@ class GnocchiCharm(GnochiCharmBase):
restart_map = {
GNOCCHI_CONF: services,
GNOCCHI_WSGI_CONF: ['apache2'],
GNOCCHI_API_PASTE: ['apache2'],
CEPH_CONF: services,
}

View File

@ -0,0 +1,32 @@
# Use gnocchi+auth in the pipeline if you want to use keystone authentication
[pipeline:main]
pipeline = gnocchi+noauth
[composite:gnocchi+noauth]
use = egg:Paste#urlmap
/ = gnocchiversions
/v1 = gnocchiv1
[composite:gnocchi+auth]
use = egg:Paste#urlmap
/ = gnocchiversions
/v1 = gnocchiv1+auth
[pipeline:gnocchiv1+auth]
pipeline = keystone_authtoken gnocchiv1
[app:gnocchiversions]
paste.app_factory = gnocchi.rest.app:app_factory
root = gnocchi.rest.VersionsController
[app:gnocchiv1]
paste.app_factory = gnocchi.rest.app:app_factory
root = gnocchi.rest.V1Controller
[filter:keystone_authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
oslo_config_project = gnocchi
[filter:cors]
paste.filter_factory = oslo_middleware.cors:filter_factory
oslo_config_project = gnocchi

View File

@ -0,0 +1,46 @@
[composite:gnocchi+noauth]
use = egg:Paste#urlmap
/ = gnocchiversions_pipeline
/v1 = gnocchiv1+noauth
/healthcheck = healthcheck
[composite:gnocchi+basic]
use = egg:Paste#urlmap
/ = gnocchiversions_pipeline
/v1 = gnocchiv1+noauth
/healthcheck = healthcheck
[composite:gnocchi+keystone]
use = egg:Paste#urlmap
/ = gnocchiversions_pipeline
/v1 = gnocchiv1+keystone
/healthcheck = healthcheck
[pipeline:gnocchiv1+noauth]
pipeline = http_proxy_to_wsgi gnocchiv1
[pipeline:gnocchiv1+keystone]
pipeline = http_proxy_to_wsgi keystone_authtoken gnocchiv1
[pipeline:gnocchiversions_pipeline]
pipeline = http_proxy_to_wsgi gnocchiversions
[app:gnocchiversions]
paste.app_factory = gnocchi.rest.app:app_factory
root = gnocchi.rest.VersionsController
[app:gnocchiv1]
paste.app_factory = gnocchi.rest.app:app_factory
root = gnocchi.rest.V1Controller
[filter:keystone_authtoken]
use = egg:keystonemiddleware#auth_token
oslo_config_project = gnocchi
[filter:http_proxy_to_wsgi]
use = egg:oslo.middleware#http_proxy_to_wsgi
oslo_config_project = gnocchi
[app:healthcheck]
use = egg:oslo.middleware#healthcheck
oslo_config_project = gnocchi

View File

@ -0,0 +1,46 @@
[composite:gnocchi+basic]
use = egg:Paste#urlmap
/ = gnocchiversions_pipeline
/v1 = gnocchiv1+noauth
/healthcheck = healthcheck
[composite:gnocchi+keystone]
use = egg:Paste#urlmap
/ = gnocchiversions_pipeline
/v1 = gnocchiv1+keystone
/healthcheck = healthcheck
[composite:gnocchi+remoteuser]
use = egg:Paste#urlmap
/ = gnocchiversions_pipeline
/v1 = gnocchiv1+noauth
/healthcheck = healthcheck
[pipeline:gnocchiv1+noauth]
pipeline = http_proxy_to_wsgi gnocchiv1
[pipeline:gnocchiv1+keystone]
pipeline = http_proxy_to_wsgi keystone_authtoken gnocchiv1
[pipeline:gnocchiversions_pipeline]
pipeline = http_proxy_to_wsgi gnocchiversions
[app:gnocchiversions]
paste.app_factory = gnocchi.rest.app:app_factory
root = gnocchi.rest.api.VersionsController
[app:gnocchiv1]
paste.app_factory = gnocchi.rest.app:app_factory
root = gnocchi.rest.api.V1Controller
[filter:keystone_authtoken]
use = egg:keystonemiddleware#auth_token
oslo_config_project = gnocchi
[filter:http_proxy_to_wsgi]
use = egg:oslo.middleware#http_proxy_to_wsgi
oslo_config_project = gnocchi
[app:healthcheck]
use = egg:oslo.middleware#healthcheck
oslo_config_project = gnocchi