Install python memcache package

When a component uses authtoken and has memcache servers specified
we should be installing the python-memcache package to satisfy the
dependency. Currently in mitaka, for example, if we have memcache
specified for say glance, it will error out because memcache is
not by default installed too.

Change-Id: I24f09937ed699479e164fdc18e149cde1695055d
Closes-Bug: #1618125
This commit is contained in:
Matthew J. Black 2016-08-29 12:34:51 -04:00 committed by Alex Schultz
parent 2704d1fb19
commit 057b176e41
3 changed files with 20 additions and 0 deletions

View File

@ -216,6 +216,10 @@
# (in seconds). Set to -1 to disable caching completely. Integer value
# Defaults to $::os_service_default.
#
# [*manage_memcache_package*]
# (Optional) Whether to install the python-memcache package.
# Defaults to false.
#
define keystone::resource::authtoken(
$username,
$password,
@ -252,6 +256,7 @@ define keystone::resource::authtoken(
$revocation_cache_time = $::os_service_default,
$signing_dir = $::os_service_default,
$token_cache_time = $::os_service_default,
$manage_memcache_package = false,
) {
include ::keystone::deps
@ -282,6 +287,13 @@ define keystone::resource::authtoken(
if !is_service_default($memcached_servers) and !empty($memcached_servers){
$memcached_servers_real = join(any2array($memcached_servers), ',')
if $manage_memcache_package {
ensure_packages('python-memcache', {
ensure => present,
name => $::keystone::params::python_memcache_package_name,
tag => ['openstack'],
})
}
} else {
$memcached_servers_real = $::os_service_default
}

View File

@ -0,0 +1,3 @@
---
issues:
- Python memcache package install when memcache servers are specified. This solves the issue where a dependency on the package was missed for components using memcache.

View File

@ -144,6 +144,7 @@ describe 'keystone::resource::authtoken' do
:memcache_pool_maxsize => '10',
:memcache_pool_dead_retry => '300',
:memcache_pool_conn_get_timeout => '10',
:manage_memcache_package => true,
})
end
it 'configures memcache severs in keystone authtoken' do
@ -156,6 +157,10 @@ describe 'keystone::resource::authtoken' do
is_expected.to contain_keystone_config('keystone_authtoken/memcache_pool_maxsize').with_value( params[:memcache_pool_maxsize] )
is_expected.to contain_keystone_config('keystone_authtoken/memcache_pool_dead_retry').with_value( params[:memcache_pool_dead_retry] )
is_expected.to contain_keystone_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value( params[:memcache_pool_conn_get_timeout] )
is_expected.to contain_package('python-memcache').with(
:name => 'python-memcache',
:ensure => 'present'
)
end
end