Add more oslo::cache params to init

This adds two new parameters cache_backend
and manage_backend_package that is simply
proxy parameters that is passed down to
oslo::cache like all other modules.

This does not introduce a behavior change
since cache_backend defaults to
$::os_service_default we do not enforce
any new package installs even though
manage_backend_package is set to true
(like it was before since that is
oslo::cache default)

Updates the testing so we test for the
oslo::cache resource and not the functionality
that the resource itself has.

Change-Id: Ib6f6853dd34e83e757bee0382ee84141e3f4dbd8
This commit is contained in:
Tobias Urdin 2020-05-27 11:33:58 +02:00
parent a02324fff4
commit 2b44bcb990
3 changed files with 31 additions and 4 deletions

View File

@ -125,10 +125,18 @@
# (string value) # (string value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*cache_backend*]
# (Optional) The backend to pass to oslo::cache.
# Defaults to $::os_service_default
#
# [*memcache_servers*] # [*memcache_servers*]
# (Optional) A list of memcached server(s) to use for caching. (list value) # (Optional) A list of memcached server(s) to use for caching. (list value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*manage_backend_package*]
# (Optional) If we should install the cache backend package.
# Defaults to true
#
# [*amqp_server_request_prefix*] # [*amqp_server_request_prefix*]
# (Optional) Address prefix used when sending to a specific server # (Optional) Address prefix used when sending to a specific server
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
@ -244,7 +252,9 @@ class ceilometer(
$kombu_reconnect_delay = $::os_service_default, $kombu_reconnect_delay = $::os_service_default,
$kombu_failover_strategy = $::os_service_default, $kombu_failover_strategy = $::os_service_default,
$kombu_compression = $::os_service_default, $kombu_compression = $::os_service_default,
$cache_backend = $::os_service_default,
$memcache_servers = $::os_service_default, $memcache_servers = $::os_service_default,
$manage_backend_package = true,
$amqp_server_request_prefix = $::os_service_default, $amqp_server_request_prefix = $::os_service_default,
$amqp_broadcast_prefix = $::os_service_default, $amqp_broadcast_prefix = $::os_service_default,
$amqp_group_request_prefix = $::os_service_default, $amqp_group_request_prefix = $::os_service_default,
@ -357,6 +367,8 @@ class ceilometer(
} }
oslo::cache { 'ceilometer_config': oslo::cache { 'ceilometer_config':
memcache_servers => $memcache_servers, backend => $cache_backend,
memcache_servers => $memcache_servers,
manage_backend_package => $manage_backend_package,
} }
} }

View File

@ -0,0 +1,5 @@
---
features:
- |
Added cache_backend and manage_backend_package parameters to ceilometer
class that is passed down to the oslo::cache resource.

View File

@ -123,7 +123,11 @@ describe 'ceilometer' do
end end
it 'configures cache backend' do it 'configures cache backend' do
is_expected.to contain_ceilometer_config('cache/memcache_servers').with_value('<SERVICE DEFAULT>') is_expected.to contain_oslo__cache('ceilometer_config').with(
:backend => '<SERVICE DEFAULT>',
:memcache_servers => '<SERVICE DEFAULT>',
:manage_backend_package => true,
)
end end
context 'with rabbitmq durable queues configured' do context 'with rabbitmq durable queues configured' do
@ -152,12 +156,18 @@ describe 'ceilometer' do
context 'with overridden cache parameter' do context 'with overridden cache parameter' do
before { before {
params.merge!( params.merge!(
:memcache_servers => 'host1:11211,host2:11211', :cache_backend => 'memcache',
:memcache_servers => 'host1:11211,host2:11211',
:manage_backend_package => false,
) )
} }
it 'configures cache backend' do it 'configures cache backend' do
is_expected.to contain_ceilometer_config('cache/memcache_servers').with_value('host1:11211,host2:11211') is_expected.to contain_oslo__cache('ceilometer_config').with(
:backend => 'memcache',
:memcache_servers => 'host1:11211,host2:11211',
:manage_backend_package => false,
)
end end
end end