From 148f02e7e035d5b467988c4cddbca37aa406c3ba Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Thu, 20 Sep 2018 10:46:18 +0200 Subject: [PATCH] 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 --- manifests/init.pp | 7 ++++++- .../notes/manage-memcache-param-4fbc465b88b062db.yaml | 6 ++++++ spec/classes/horizon_init_spec.rb | 9 +++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/manage-memcache-param-4fbc465b88b062db.yaml diff --git a/manifests/init.pp b/manifests/init.pp index a4d1f757..348d37cf 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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']}}) diff --git a/releasenotes/notes/manage-memcache-param-4fbc465b88b062db.yaml b/releasenotes/notes/manage-memcache-param-4fbc465b88b062db.yaml new file mode 100644 index 00000000..5abcbd84 --- /dev/null +++ b/releasenotes/notes/manage-memcache-param-4fbc465b88b062db.yaml @@ -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. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 34b9cfa2..60373868 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -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',