Merge "Add support for [paste_deploy] config_file"

This commit is contained in:
Zuul 2022-07-15 20:06:02 +00:00 committed by Gerrit Code Review
commit 47b92f3294
3 changed files with 64 additions and 20 deletions

View File

@ -33,11 +33,14 @@
# (optional) Type is authorization being used.
# Defaults to 'keystone'
#
# [*pipeline*]
# (optional) Partial name of a pipeline in your paste configuration file with the
# service name removed.
# [*paste_deploy_flavor*]
# (optional) Deployment flavor to use in the server application pipeline.
# Defaults to 'keystone'.
#
# [*paste_deploy_config_file*]
# (optional) Name of the paste configuration file.
# Defaults to $::os_service_default.
#
# [*manage_service*]
# (optional) If Puppet should manage service startup / shutdown.
# Defaults to true.
@ -293,6 +296,11 @@
# (optional) File access permissions for the image files.
# Defaults to undef
#
# [*pipeline*]
# (optional) Partial name of a pipeline in your paste configuration file with the
# service name removed.
# Defaults to undef
#
class glance::api(
$package_ensure = 'present',
$bind_host = $::os_service_default,
@ -301,7 +309,8 @@ class glance::api(
$workers = $::os_workers,
$delayed_delete = $::os_service_default,
$auth_strategy = 'keystone',
$pipeline = 'keystone',
$paste_deploy_flavor = 'keystone',
$paste_deploy_config_file = $::os_service_default,
$manage_service = true,
$enabled = true,
$show_image_direct_url = $::os_service_default,
@ -359,6 +368,7 @@ class glance::api(
$ca_file = undef,
$filesystem_store_metadata_file = undef,
$filesystem_store_file_perm = undef,
$pipeline = undef,
) inherits glance {
include glance::deps
@ -578,17 +588,27 @@ enabled_backends instead.')
'inject_metadata_properties/ignore_user_roles': value => $ignore_user_roles;
}
# Set the pipeline, it is allowed to be blank
if $pipeline != '' {
validate_legacy(Pattern[/^(\w+([+]\w+)*)*$/], 'validate_re', $pipeline, ['^(\w+([+]\w+)*)*$'])
if $pipeline != undef {
warning('The pipeline parameter has been deprecated. Use the paste_deploy_flavor parmaeter instead.')
$paste_deploy_flavor_real = $pipeline
} else {
$paste_deploy_flavor_real = $paste_deploy_flavor
}
# Set the flavor, it is allowed to be blank
if $paste_deploy_flavor_real != '' {
validate_legacy(Pattern[/^(\w+([+]\w+)*)*$/], 'validate_re', $paste_deploy_flavor_real, ['^(\w+([+]\w+)*)*$'])
glance_api_config {
'paste_deploy/flavor':
ensure => present,
value => $pipeline,
'paste_deploy/flavor': value => $paste_deploy_flavor_real
}
} else {
glance_api_config { 'paste_deploy/flavor': ensure => absent }
glance_api_config {
'paste_deploy/flavor': ensure => absent
}
}
glance_api_config {
'paste_deploy/config_file': value => $paste_deploy_config_file
}
# keystone config

View File

@ -0,0 +1,11 @@
---
features:
- |
The ``paste_deploy_flavor`` parameter and the ``paste_deploy_config_file``
parameter have been added to the ``glance::api`` class. These two
parameters allow customizing options in the ``[paste_deploy]`` section.
deprecations:
- |
The ``glance::api::pipeline`` parameter has been deprecated in favor of
the new ``paste_deploy_flavor`` parameter.

View File

@ -43,7 +43,8 @@ describe 'glance::api' do
:image_cache_max_size => '<SERVICE DEFAULT>',
:cache_prefetcher_interval => '<SERVICE DEFAULT>',
:disk_formats => '<SERVICE DEFAULT>',
:pipeline => 'keystone',
:paste_deploy_flavor => 'keystone',
:paste_deploy_config_file => '<SERVICE DEFAULT>',
:task_time_to_live => '<SERVICE DEFAULT>',
:task_executor => '<SERVICE DEFAULT>',
:task_work_dir => '<SERVICE DEFAULT>',
@ -90,7 +91,8 @@ describe 'glance::api' do
:image_cache_stall_time => '10',
:image_cache_max_size => '10737418240',
:cache_prefetcher_interval => '300',
:pipeline => 'keystone2',
:paste_deploy_flavor => 'keystone+caching',
:paste_deploy_config_file => 'glance-api-paste.ini',
:sync_db => false,
:limit_param_default => '10',
:api_limit_max => '10',
@ -126,7 +128,8 @@ describe 'glance::api' do
'tag' => 'glance-service',
) }
it { is_expected.to contain_glance_api_config("paste_deploy/flavor").with_value(param_hash[:pipeline]) }
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_value(param_hash[:paste_deploy_flavor]) }
it { is_expected.to contain_glance_api_config('paste_deploy/config_file').with_value(param_hash[:paste_deploy_config_file]) }
it 'is_expected.to lay down default api config' do
[
@ -229,7 +232,17 @@ describe 'glance::api' do
it { is_expected.to_not contain_service('glance-api') }
end
describe 'with overridden pipeline' do
describe 'with overridden flavor' do
let :params do
{
:paste_deploy_flavor => 'something',
}
end
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_value('something') }
end
describe 'with flavor overridden by the deprecated pipeline parameter' do
let :params do
{
:pipeline => 'something',
@ -239,10 +252,10 @@ describe 'glance::api' do
it { is_expected.to contain_glance_api_config('paste_deploy/flavor').with_value('something') }
end
describe 'with blank pipeline' do
describe 'with blank flavor' do
let :params do
{
:pipeline => '',
:paste_deploy_flavor => '',
}
end
@ -255,11 +268,11 @@ describe 'glance::api' do
'+keystone',
'keystone+cachemanagement+',
'+'
].each do |pipeline|
describe "with pipeline incorrect value #{pipeline}" do
].each do |flavor|
describe "with flavor set by incorrect value #{flavor}" do
let :params do
{
:pipeline => pipeline
:flavor => flavor
}
end