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:
@@ -150,6 +150,10 @@
|
|||||||
# (Optional) Whether to install the backend package.
|
# (Optional) Whether to install the backend package.
|
||||||
# Defaults to true.
|
# Defaults to true.
|
||||||
#
|
#
|
||||||
|
# [*package_ensure*]
|
||||||
|
# (Optional) ensure state for package.
|
||||||
|
# Defaults to 'present'
|
||||||
|
#
|
||||||
define oslo::cache(
|
define oslo::cache(
|
||||||
$config_prefix = $::os_service_default,
|
$config_prefix = $::os_service_default,
|
||||||
$expiration_time = $::os_service_default,
|
$expiration_time = $::os_service_default,
|
||||||
@@ -170,6 +174,7 @@ define oslo::cache(
|
|||||||
$tls_keyfile = $::os_service_default,
|
$tls_keyfile = $::os_service_default,
|
||||||
$tls_allowed_ciphers = $::os_service_default,
|
$tls_allowed_ciphers = $::os_service_default,
|
||||||
$manage_backend_package = true,
|
$manage_backend_package = true,
|
||||||
|
$package_ensure = 'present',
|
||||||
){
|
){
|
||||||
|
|
||||||
include oslo::params
|
include oslo::params
|
||||||
@@ -187,14 +192,15 @@ define oslo::cache(
|
|||||||
if $manage_backend_package {
|
if $manage_backend_package {
|
||||||
if ($backend =~ /pylibmc/ ) {
|
if ($backend =~ /pylibmc/ ) {
|
||||||
ensure_packages('python-pylibmc', {
|
ensure_packages('python-pylibmc', {
|
||||||
ensure => present,
|
ensure => $package_ensure,
|
||||||
name => $::oslo::params::pylibmc_package_name,
|
name => $::oslo::params::pylibmc_package_name,
|
||||||
tag => 'openstack',
|
tag => 'openstack',
|
||||||
})
|
})
|
||||||
} elsif ($backend =~ /\.memcache/ ) {
|
} elsif ($backend =~ /\.memcache/ ) {
|
||||||
ensure_packages('python-memcache', {
|
ensure_packages('python-memcache', {
|
||||||
name => $::oslo::params::python_memcache_package_name,
|
ensure => $package_ensure,
|
||||||
tag => ['openstack'],
|
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
|
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
|
context 'with backend package management disabled' do
|
||||||
before do
|
before do
|
||||||
params.merge!({
|
params.merge!({
|
||||||
@@ -114,11 +130,28 @@ describe 'oslo::cache' do
|
|||||||
it 'configures cache backend' do
|
it 'configures cache backend' do
|
||||||
is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcache')
|
is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcache')
|
||||||
is_expected.to contain_package('python-memcache').with(
|
is_expected.to contain_package('python-memcache').with(
|
||||||
|
:ensure => 'present',
|
||||||
:name => platform_params[:python_memcache_package_name],
|
:name => platform_params[:python_memcache_package_name],
|
||||||
:tag => ['openstack'],
|
:tag => ['openstack'],
|
||||||
)
|
)
|
||||||
end
|
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
|
context 'with backend package management disabled' do
|
||||||
before do
|
before do
|
||||||
params.merge!({
|
params.merge!({
|
||||||
|
Reference in New Issue
Block a user