cache: Allow customizing status of the backend package
This change introduces the package_ensure parameter to oslo::cache resource type, so that users can define status of the backend package. Change-Id: I34f10b51e1179beed327b9544b0899105cb30895
This commit is contained in:
parent
b05244e2a1
commit
eb5bd8e330
|
@ -150,6 +150,10 @@
|
|||
# (Optional) Whether to install the backend package.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (Optional) ensure state for package.
|
||||
# Defaults to 'present'
|
||||
#
|
||||
define oslo::cache(
|
||||
$config_prefix = $::os_service_default,
|
||||
$expiration_time = $::os_service_default,
|
||||
|
@ -170,6 +174,7 @@ define oslo::cache(
|
|||
$tls_keyfile = $::os_service_default,
|
||||
$tls_allowed_ciphers = $::os_service_default,
|
||||
$manage_backend_package = true,
|
||||
$package_ensure = 'present',
|
||||
){
|
||||
|
||||
include oslo::params
|
||||
|
@ -187,14 +192,15 @@ define oslo::cache(
|
|||
if $manage_backend_package {
|
||||
if ($backend =~ /pylibmc/ ) {
|
||||
ensure_packages('python-pylibmc', {
|
||||
ensure => present,
|
||||
ensure => $package_ensure,
|
||||
name => $::oslo::params::pylibmc_package_name,
|
||||
tag => 'openstack',
|
||||
})
|
||||
} elsif ($backend =~ /\.memcache/ ) {
|
||||
ensure_packages('python-memcache', {
|
||||
name => $::oslo::params::python_memcache_package_name,
|
||||
tag => ['openstack'],
|
||||
ensure => $package_ensure,
|
||||
name => $::oslo::params::python_memcache_package_name,
|
||||
tag => ['openstack'],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The new ``oslo::cache::package_ensure`` parameter has been added. This
|
||||
parameter defines status of the backend package used.
|
|
@ -91,6 +91,22 @@ describe 'oslo::cache' do
|
|||
)
|
||||
end
|
||||
|
||||
context 'with package_ensure set' do
|
||||
before do
|
||||
params.merge!({
|
||||
:package_ensure => 'latest'
|
||||
})
|
||||
end
|
||||
|
||||
it 'ensures status of the package' do
|
||||
is_expected.to contain_package('python-pylibmc').with(
|
||||
:ensure => 'latest',
|
||||
:name => platform_params[:pylibmc_package_name],
|
||||
:tag => 'openstack',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with backend package management disabled' do
|
||||
before do
|
||||
params.merge!({
|
||||
|
@ -114,11 +130,28 @@ describe 'oslo::cache' do
|
|||
it 'configures cache backend' do
|
||||
is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcache')
|
||||
is_expected.to contain_package('python-memcache').with(
|
||||
:ensure => 'present',
|
||||
:name => platform_params[:python_memcache_package_name],
|
||||
:tag => ['openstack'],
|
||||
)
|
||||
end
|
||||
|
||||
context 'with package_ensure set' do
|
||||
before do
|
||||
params.merge!({
|
||||
:package_ensure => 'latest'
|
||||
})
|
||||
end
|
||||
|
||||
it 'ensures status of the package' do
|
||||
is_expected.to contain_package('python-memcache').with(
|
||||
:ensure => 'latest',
|
||||
:name => platform_params[:python_memcache_package_name],
|
||||
:tag => ['openstack'],
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with backend package management disabled' do
|
||||
before do
|
||||
params.merge!({
|
||||
|
|
Loading…
Reference in New Issue