From fdbf846d153688d514a18d3c516a6798eb1fe9e6 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Thu, 5 Apr 2012 09:27:04 -0700 Subject: [PATCH] Refactor api-ini config files Previously, I was trying to configure the auth context based on the auth type. After receiving feedback that these sections from auth context should not be configured, I have refactored this code to remove this configuration. --- manifests/api.pp | 10 +--------- manifests/init.pp | 1 + manifests/registry.pp | 6 ------ templates/glance-api-paste.ini.erb | 15 +++------------ templates/glance-registry-paste.ini.erb | 11 +---------- 5 files changed, 6 insertions(+), 37 deletions(-) diff --git a/manifests/api.pp b/manifests/api.pp index 17cfa263..5249d325 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -1,4 +1,4 @@ -# = Class: glance::api + # # This class installs and configures the glance api server. # @@ -53,14 +53,6 @@ class glance::api( # used to configure concat include 'concat::setup' - # TODO I need to work with Chris to ensure that I understand - # his auth requirements - if($auth_type == 'keystone') { - $context_type = 'context' - } else { - $context_type = 'auth-context' - } - File { ensure => present, owner => 'glance', diff --git a/manifests/init.pp b/manifests/init.pp index 38f70a51..170603de 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,6 +15,7 @@ class glance( name => $::glance::params::package_name, ensure => $package_ensure, } + # TODO - if the packaging is fixed can I remove this? if(! defined(Package['python-migrate'])) { package { 'python-migrate': ensure => 'present' } } diff --git a/manifests/registry.pp b/manifests/registry.pp index 8a0d81b6..507de2ea 100644 --- a/manifests/registry.pp +++ b/manifests/registry.pp @@ -17,12 +17,6 @@ class glance::registry( $keystone_password = 'ChangeMe' ) inherits glance { - if($auth_type == 'keystone') { - $context_type = 'context' - } else { - $context_type = 'auth-context' - } - File { ensure => present, owner => 'glance', diff --git a/templates/glance-api-paste.ini.erb b/templates/glance-api-paste.ini.erb index fb900e70..4a2176b1 100644 --- a/templates/glance-api-paste.ini.erb +++ b/templates/glance-api-paste.ini.erb @@ -8,7 +8,7 @@ pipeline = versionnegotiation context apiv1app # flavor = keystone # [pipeline:glance-api-keystone] -pipeline = versionnegotiation authtoken <%= context_type %> apiv1app +pipeline = versionnegotiation authtoken context apiv1app # Use the following pipeline to enable transparent caching of image files # i.e. in glance-api.conf: @@ -24,7 +24,7 @@ pipeline = versionnegotiation context cache apiv1app # flavor = keystone+caching # [pipeline:glance-api-keystone+caching] -pipeline = versionnegotiation authtoken <%= context_type %> cache apiv1app +pipeline = versionnegotiation authtoken context cache apiv1app # Use the following pipeline to enable the Image Cache Management API # i.e. in glance-api.conf: @@ -40,7 +40,7 @@ pipeline = versionnegotiation context cache cachemanage apiv1app # flavor = keystone+cachemanagement # [pipeline:glance-api-keystone+cachemanagement] -pipeline = versionnegotiation authtoken <%= context_type %> cache cachemanage apiv1app +pipeline = versionnegotiation authtoken context cache cachemanage apiv1app [app:apiv1app] paste.app_factory = glance.common.wsgi:app_factory @@ -72,13 +72,4 @@ auth_uri = <%= auth_uri %> admin_tenant_name = <%= keystone_tenant %> admin_user = <%= keystone_user %> admin_password = <%= keystone_password %> -<% else -%> -admin_token = <%= admin_token %> <% end -%> - -<% if context_type == 'auth-context' -%> -[filter:auth-context] -paste.filter_factory = glance.common.wsgi:filter_factory -glance.filter_factory = keystone.middleware.glance_auth_token:KeystoneContextMiddleware -<% end -%> - diff --git a/templates/glance-registry-paste.ini.erb b/templates/glance-registry-paste.ini.erb index 1caf61e0..4f0f4d5b 100644 --- a/templates/glance-registry-paste.ini.erb +++ b/templates/glance-registry-paste.ini.erb @@ -8,7 +8,7 @@ pipeline = context registryapp # flavor = keystone [pipeline:glance-registry-keystone] -pipeline = authtoken <%= context_type %> registryapp +pipeline = authtoken context registryapp [app:registryapp] paste.app_factory = glance.common.wsgi:app_factory @@ -29,13 +29,4 @@ auth_uri = <%= auth_uri %> admin_tenant_name = <%= keystone_tenant %> admin_user = <%= keystone_user %> admin_password = <%= keystone_password %> -<% else -%> -admin_token = <%= admin_token %> -<% end -%> - -<% if context_type == 'auth-context' -%> -[filter:auth-context] -context_class = glance.registry.context.RequestContext -paste.filter_factory = glance.common.wsgi:filter_factory -glance.filter_factory = keystone.middleware.glance_auth_token:KeystoneContextMiddleware <% end -%>