Glance: Include the required classes for image cache

This change is a prep work to migrate class composition for image cache
feature from tripleo-heat-templates to puppet-tripleo, so that we can
gather all logics to compose required puppet classes in puppet-tripleo.

Change-Id: I843d72542154a2e278ba257f6b61ed573c7c3860
This commit is contained in:
Takashi Kajinami 2020-12-31 12:27:07 +09:00
parent 197c12e6aa
commit 950275ed05
2 changed files with 35 additions and 0 deletions

View File

@ -127,6 +127,10 @@
# (optional) Whether to enable db purging
# defaults to true
#
# [*glance_enable_cache*]
# (optional) Whether to enable caching
# defaults to false
#
# DEPRECATED PARAMETERS
#
# [*glance_rbd_client_name*]
@ -158,6 +162,7 @@ class tripleo::profile::base::glance::api (
$tls_proxy_fqdn = undef,
$tls_proxy_port = 9292,
$glance_enable_db_purge = true,
$glance_enable_cache = false,
# DEPRECATED PARAMETERS
$glance_rbd_client_name = undef,
) {
@ -258,6 +263,10 @@ class tripleo::profile::base::glance::api (
if $glance_enable_db_purge {
include glance::cron::db_purge
}
if $glance_enable_cache {
include glance::cache::cleaner
include glance::cache::pruner
}
}
}

View File

@ -36,6 +36,8 @@ describe 'tripleo::profile::base::glance::api' do
is_expected.to_not contain_class('glance::api')
is_expected.to_not contain_class('glance::notify::rabbitmq')
is_expected.to_not contain_class('glance::cron::db_purge')
is_expected.to_not contain_class('glance::cache::cleaner')
is_expected.to_not contain_class('glance::cache::pruner')
end
end
@ -64,6 +66,8 @@ describe 'tripleo::profile::base::glance::api' do
:notification_transport_url => 'rabbit://glance2:baa@192.168.0.2:5678/?ssl=0',
)
is_expected.to_not contain_class('glance::cron::db_purge')
is_expected.to_not contain_class('glance::cache::cleaner')
is_expected.to_not contain_class('glance::cache::pruner')
end
end
@ -81,6 +85,8 @@ describe 'tripleo::profile::base::glance::api' do
is_expected.to_not contain_class('glance::api')
is_expected.to_not contain_class('glance::notify::rabbitmq')
is_expected.to_not contain_class('glance::cron::db_purge')
is_expected.to_not contain_class('glance::cache::cleaner')
is_expected.to_not contain_class('glance::cache::pruner')
end
end
@ -118,6 +124,8 @@ describe 'tripleo::profile::base::glance::api' do
:notification_transport_url => 'rabbit://glance2:baa@192.168.0.2:5678/?ssl=0',
)
is_expected.to_not contain_class('glance::cron::db_purge')
is_expected.to_not contain_class('glance::cache::cleaner')
is_expected.to_not contain_class('glance::cache::pruner')
end
context 'with multistore_config' do
@ -195,6 +203,11 @@ describe 'tripleo::profile::base::glance::api' do
it 'should configure db_purge' do
is_expected.to contain_class('glance::cron::db_purge')
end
it 'should not configure cache' do
is_expected.to_not contain_class('glance::cache::cleaner')
is_expected.to_not contain_class('glance::cache::pruner')
end
end
context 'with step 5 without db_purge' do
@ -208,6 +221,19 @@ describe 'tripleo::profile::base::glance::api' do
is_expected.to_not contain_class('glance::cron::db_purge')
end
end
context 'with step 5 with cache' do
let(:params) { {
:step => 5,
:bootstrap_node => 'node.example.com',
:glance_enable_cache => true,
} }
it 'should configure cache' do
is_expected.to contain_class('glance::cache::cleaner')
is_expected.to contain_class('glance::cache::pruner')
end
end
end
on_supported_os.each do |os, facts|