Add manage_memcache_package parameter

Adds a new parameter named manage_memcache_package that
can be used to set if we should install the python memcache
library if memcache caching is enabled.

Change-Id: I924f837afc756817c202637b1b7db83c125df1d8
This commit is contained in:
Tobias Urdin 2018-09-20 10:46:18 +02:00
parent a0dc7d17e5
commit 148f02e7e0
3 changed files with 21 additions and 1 deletions

View File

@ -47,6 +47,10 @@
# [*cache_server_port*]
# (optional) Memcached port. Defaults to '11211'.
#
# [*manage_memcache_package*]
# (optional) Boolean if we should manage the memcache package.
# Defaults to true
#
# [*horizon_app_links*]
# (optional) Array of arrays that can be used to add call-out links
# to the dashboard for other apps. There is no specific requirement
@ -459,6 +463,7 @@ class horizon(
$cache_server_url = undef,
$cache_server_ip = undef,
$cache_server_port = '11211',
$manage_memcache_package = true,
$horizon_app_links = false,
$keystone_url = 'http://127.0.0.1:5000',
$keystone_default_role = '_member_',
@ -601,7 +606,7 @@ class horizon(
validate_re($images_panel, ['^legacy$', '^angular$'])
validate_absolute_path($root_path)
if $cache_backend =~ /MemcachedCache/ {
if $manage_memcache_package and $cache_backend =~ /MemcachedCache/ {
ensure_resources('package', { 'python-memcache' =>
{ name => $::horizon::params::memcache_package,
tag => ['openstack', 'horizon-package']}})

View File

@ -0,0 +1,6 @@
---
features:
- |
Added a new parameter horizon::manage_memcache_package that can be used to
determine if you want the python memcache library installed if the cache
backend is set to using memcache.

View File

@ -280,6 +280,15 @@ describe 'horizon' do
}
end
context 'does not install python memcache when manage_memcache_package set to false' do
before do
params.merge!( :cache_backend => 'django.core.cache.backends.memcached.MemcachedCache',
:manage_memcache_package => false )
end
it { is_expected.not_to contain_package('python-memcache') }
end
context 'with custom wsgi options' do
before do
params.merge!( :wsgi_processes => '30',