Showing with 50 additions and 10 deletions.
  1. +1 −1 Modulefile
  2. +1 −1 manifests/config.pp
  3. +4 −0 manifests/init.pp
  4. +5 −1 manifests/params.pp
  5. +33 −5 spec/classes/redis_spec.rb
  6. +6 −2 templates/redis.conf.erb
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'arioch-redis'
version '0.0.7'
version '0.0.8'
author 'Tom De Vylder'
license 'Apache License, Version 2.0'
summary 'Redis module'
Expand Down
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

$::redis::config_file:
ensure => present,
content => template('redis/redis.conf.erb');
content => template($::redis::conf_template);

$::redis::log_dir:
ensure => directory,
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
$config_file_mode = $::redis::params::config_file_mode,
$config_group = $::redis::params::config_group,
$config_owner = $::redis::params::config_owner,
$conf_template = $::redis::params::conf_template,
$daemonize = $::redis::params::daemonize,
$databases = $::redis::params::databases,
$dbfilename = $::redis::params::dbfilename,
$extra_config_file = $::redis::params::extra_config_file,
$hash_max_ziplist_entries = $::redis::params::hash_max_ziplist_entries,
$hash_max_ziplist_value = $::redis::params::hash_max_ziplist_value,
$list_max_ziplist_entries = $::redis::params::list_max_ziplist_entries,
Expand Down Expand Up @@ -69,6 +71,8 @@
$slaveof = $::redis::params::slaveof,
$slowlog_log_slower_than = $::redis::params::slowlog_log_slower_than,
$slowlog_max_len = $::redis::params::slowlog_max_len,
$syslog_enabled = $::redis::params::syslog_enabled,
$syslog_facility = $::redis::params::syslog_facility,
$timeout = $::redis::params::timeout,
$ulimit = $::redis::params::ulimit,
$workdir = $::redis::params::workdir,
Expand Down
6 changes: 5 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
$appendonly = false
$auto_aof_rewrite_min_size = '64min'
$auto_aof_rewrite_percentage = 100
$bind = $::ipaddress
$bind = '127.0.0.1'
$conf_template = 'redis/redis.conf.erb'
$daemonize = true
$databases = 16
$dbfilename = 'dump.rdb'
$extra_config_file = undef
$hash_max_ziplist_entries = 512
$hash_max_ziplist_value = 64
$list_max_ziplist_entries = 512
Expand All @@ -35,6 +37,8 @@
$set_max_intset_entries = 512
$slowlog_log_slower_than = 10000
$slowlog_max_len = 1024
$syslog_enabled = undef
$syslog_facility = undef
$timeout = 0
$ulimit = 65536
$workdir = '/var/lib/redis/'
Expand Down
38 changes: 33 additions & 5 deletions spec/classes/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

describe 'without parameters' do
it { should create_class('redis') }
it { should include_class('redis::preinstall') }
it { should include_class('redis::install') }
it { should include_class('redis::config') }
it { should include_class('redis::service') }
it { should contain_class('redis::preinstall') }
it { should contain_class('redis::install') }
it { should contain_class('redis::config') }
it { should contain_class('redis::service') }

it { should contain_package('redis-server').with_ensure('present') }

Expand Down Expand Up @@ -274,10 +274,10 @@
let (:params) { { :manage_repo => true } }

context 'on Debian' do
let (:facts) { debian_facts }
let (:facts) {
{
:lsbdistcodename => 'wheezy',
:lsbdistid => 'Debian',
:operatingsystem => 'Debian',
:osfamily => 'Debian'
}
Expand All @@ -291,6 +291,7 @@
let (:facts) {
{
:lsbdistcodename => 'raring',
:lsbdistid => 'Ubuntu',
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
Expand Down Expand Up @@ -621,6 +622,33 @@
}
end

describe 'with parameter syslog_enabled' do
let (:params) {
{
:syslog_enabled => true
}
}

it { should contain_file('/etc/redis/redis.conf').with(
'content' => /syslog-enabled yes/
)
}
end

describe 'with parameter syslog_facility' do
let (:params) {
{
:syslog_enabled => true,
:syslog_facility => '_VALUE_'
}
}

it { should contain_file('/etc/redis/redis.conf').with(
'content' => /syslog-facility.*_VALUE_/
)
}
end

describe 'with parameter timeout' do
let (:params) {
{
Expand Down
8 changes: 6 additions & 2 deletions templates/redis.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ logfile <%= @log_file %>

# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
<% if @syslog_enabled -%>syslog-enabled yes<% else -%>syslog-enabled no<% end -%>
<% if @syslog_enabled %>syslog-enabled yes<% else %>syslog-enabled no<% end %>

# Specify the syslog identity.
# syslog-ident redis

# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# syslog-facility local0
<% if @syslog_facility %>syslog-facility <%= @syslog_facility %><% else %># syslog-facility local0<% end %>

# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT <dbid> where
Expand Down Expand Up @@ -541,3 +541,7 @@ client-output-buffer-limit pubsub 32mb 8mb 60
#
# include /path/to/local.conf
# include /path/to/other.conf
<% if @extra_config_file -%>
include <%= @extra_config_file %>
<% end -%>