Merge "Add cache_backend and cache_options params"
This commit is contained in:
commit
04239bd5a5
@ -34,9 +34,17 @@
|
||||
# [*package_ensure*]
|
||||
# (optional) Package ensure state. Defaults to 'present'.
|
||||
#
|
||||
# [*cache_backend*]
|
||||
# (optional) Horizon cache backend.
|
||||
# Defaults: 'django.core.cache.backends.locmem.LocMemCache'
|
||||
#
|
||||
# [*cache_options*]
|
||||
# (optional) A hash of parameters to enable specific cache options.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*cache_server_ip*]
|
||||
# (optional) Memcached IP address. Can be a string, or an array.
|
||||
# Defaults to '127.0.0.1'.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*cache_server_port*]
|
||||
# (optional) Memcached port. Defaults to '11211'.
|
||||
@ -216,7 +224,9 @@ class horizon(
|
||||
$secret_key,
|
||||
$fqdn = undef,
|
||||
$package_ensure = 'present',
|
||||
$cache_server_ip = '127.0.0.1',
|
||||
$cache_backend = 'django.core.cache.backends.locmem.LocMemCache',
|
||||
$cache_options = undef,
|
||||
$cache_server_ip = undef,
|
||||
$cache_server_port = '11211',
|
||||
$horizon_app_links = false,
|
||||
$keystone_url = 'http://127.0.0.1:5000/v2.0',
|
||||
|
@ -83,6 +83,8 @@ describe 'horizon' do
|
||||
context 'with overridden parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:cache_backend => 'horizon.backends.memcached.HorizonMemcached',
|
||||
:cache_options => {'SOCKET_TIMEOUT' => 1,'SERVER_RETRIES' => 1,'DEAD_RETRY' => 1},
|
||||
:cache_server_ip => '10.0.0.1',
|
||||
:django_session_engine => 'django.contrib.sessions.backends.cache',
|
||||
:keystone_default_role => 'SwiftOperator',
|
||||
@ -110,6 +112,10 @@ describe 'horizon' do
|
||||
'CSRF_COOKIE_SECURE = True',
|
||||
'SESSION_COOKIE_SECURE = True',
|
||||
"SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'",
|
||||
" 'DEAD_RETRY': 1,",
|
||||
" 'SERVER_RETRIES': 1,",
|
||||
" 'SOCKET_TIMEOUT': 1,",
|
||||
" 'BACKEND': 'horizon.backends.memcached.HorizonMemcached',",
|
||||
" 'LOCATION': '10.0.0.1:11211',",
|
||||
'SESSION_ENGINE = "django.contrib.sessions.backends.cache"',
|
||||
'OPENSTACK_KEYSTONE_URL = "https://keystone.example.com:4682"',
|
||||
|
@ -118,17 +118,20 @@ SECRET_KEY = '<%= @secret_key %>'
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
<% if @cache_options.kind_of?(Hash) %>
|
||||
'OPTIONS': {
|
||||
<% @cache_options.sort.each do |opt_name,opt_val| -%>
|
||||
'<%= opt_name -%>': <%= opt_val -%>,
|
||||
<% end -%>},
|
||||
<% end -%>
|
||||
'BACKEND': '<%= @cache_backend %>',
|
||||
<% if @cache_server_ip %>
|
||||
# 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
<% if @cache_server_ip.kind_of?(Array) %>
|
||||
<% split = ":" + @cache_server_port + "','" %>
|
||||
'LOCATION': [ <% @cache_server_ip.each do |ip| -%>'<%= ip -%>:<%= @cache_server_port -%>',<% end -%> ],
|
||||
<% else %>
|
||||
'LOCATION': '<%= @cache_server_ip %>:<%= @cache_server_port %>',
|
||||
<% end %>
|
||||
<% else %>
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
||||
<% end %>
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user