36 changes: 30 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
# Change Log
# Change log

## [Unreleased](https://github.com/arioch/puppet-redis/tree/HEAD)
All notable changes to this project will be documented in this file.

[Full Changelog](https://github.com/arioch/puppet-redis/compare/v3.1.0...HEAD)
## [v3.2.0](https://github.com/arioch/puppet-redis/tree/v3.2.0) (2017-07-11)
[Full Changelog](https://github.com/arioch/puppet-redis/compare/v3.1.1...v3.2.0)

## [v3.1.0](https://github.com/arioch/puppet-redis/tree/v3.1.0) (2017-05-11)
**Implemented enhancements:**

- Cluster Support [\#62](https://github.com/arioch/puppet-redis/issues/62)

**Closed issues:**

- redis\_server\_version fact fails to parse output [\#210](https://github.com/arioch/puppet-redis/issues/210)
- Support for multi-instances per host [\#113](https://github.com/arioch/puppet-redis/issues/113)

**Merged pull requests:**

- updated redis systemd unit file for better use with instances [\#214](https://github.com/arioch/puppet-redis/pull/214) ([bostrowski13](https://github.com/bostrowski13))
- Updates docker images for CentOS 6 and 7 [\#213](https://github.com/arioch/puppet-redis/pull/213) ([petems](https://github.com/petems))
- Update EPEL module [\#212](https://github.com/arioch/puppet-redis/pull/212) ([petems](https://github.com/petems))
- Refactor redisget\(\) method [\#211](https://github.com/arioch/puppet-redis/pull/211) ([petems](https://github.com/petems))
- Update docs for puppet-strings [\#206](https://github.com/arioch/puppet-redis/pull/206) ([petems](https://github.com/petems))
- Add redis::instance defined type [\#200](https://github.com/arioch/puppet-redis/pull/200) ([petems](https://github.com/petems))
- Adding note about Puppet 3 support [\#153](https://github.com/arioch/puppet-redis/pull/153) ([petems](https://github.com/petems))

## [v3.1.1](https://github.com/arioch/puppet-redis/tree/v3.1.1) (2017-05-19)
[Full Changelog](https://github.com/arioch/puppet-redis/compare/v3.1.0...v3.1.1)

[Full Changelog](https://github.com/arioch/puppet-redis/compare/3.0.0...v3.1.0)
## [v3.1.0](https://github.com/arioch/puppet-redis/tree/v3.1.0) (2017-05-19)
[Full Changelog](https://github.com/arioch/puppet-redis/compare/v3.0.0...v3.1.0)

**Implemented enhancements:**

- Releasing v3.0.1 [\#205](https://github.com/arioch/puppet-redis/issues/205)
- Please cut a release [\#201](https://github.com/arioch/puppet-redis/issues/201)
- Deployment to Forge [\#185](https://github.com/arioch/puppet-redis/issues/185)

**Fixed bugs:**

Expand Down Expand Up @@ -341,4 +365,4 @@
## [0.0.1](https://github.com/arioch/puppet-redis/tree/0.0.1) (2013-06-19)


\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ group :test do
gem 'puppet-lint-unquoted_string-check', :require => false
gem 'puppet-lint-variable_contains_upcase', :require => false
gem 'metadata-json-lint', :require => false
gem 'puppet-strings', '0.4.0', :require => false
gem 'puppet-strings', '1.1.0', :require => false
gem 'puppet_facts', :require => false
gem 'rubocop-rspec', '~> 1.6', :require => false if RUBY_VERSION >= '2.3.0'
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
Expand All @@ -39,6 +39,7 @@ end
group :development do
gem 'puppet-blacksmith'
gem 'travis'
gem 'github_changelog_generator'
end

group :system_tests do
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ Test against a specific Puppet or Facter version:
$ PUPPET_VERSION=4.10.0 bundle update && bundle exec rake spec
$ FACTER_VERSION=1.6.8 bundle update && bundle exec rake spec

## Puppet 3 Support

Puppet 3 is EOL as-of January 2017. The last release of this module that will
support Puppet 3.X and earlier will be the 3.X.X module releases.

Module versions from 4.X.X onwards will use Puppet 4 only features and will not work with
earlier versions.

We would recommend upgrading your Puppet agent to the latest release, as Puppet 4 comes with a load of awesome new features.

If you're stuck with older Puppet, you could also fork the module from 3.0.0 and use your fork as a Puppet 3 supported version.

## Contributing

* Fork it
Expand Down
12 changes: 12 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-strings/tasks'

# These two gems aren't always present, for instance
# on Travis with --without development
Expand Down Expand Up @@ -35,3 +36,14 @@ task :test => [
:lint,
:spec,
]

begin
require 'github_changelog_generator/task'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
version = (Blacksmith::Modulefile.new).version
config.future_release = "v#{version}"
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file."
config.exclude_labels = %w{duplicate question invalid wontfix modulesync}
end
rescue LoadError
end
20 changes: 6 additions & 14 deletions lib/puppet/parser/functions/redisget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,12 @@ module Puppet::Parser::Functions
raise(Puppet::ParseError, "redisget(): Wrong argument type given (#{url.class} for String) for arg2 (url)") if url.is_a?(String) == false

begin
redis = Redis.new(:url => url)
returned_value = redis.get(key)
if returned_value == nil and defined?(default) != nil
default
else
returned_value
end
rescue Exception => e
if default
debug "Connection to redis failed with #{e} - Returning default value of #{default}"
default
else
raise(Puppet::Error, "connection to redis server failed - #{e}")
end
Redis.new(:url => url).get(key) || default
rescue Redis::CannotConnectError, SocketError => e
raise Puppet::Error, "connection to redis server failed - #{e}" unless default
debug "Connection to redis failed with #{e} - Returning default value of #{default}"
default
end

end
end
99 changes: 7 additions & 92 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,6 @@
# This class provides configuration for Redis.
#
class redis::config {
$activerehashing = $::redis::activerehashing
$aof_load_truncated = $::redis::aof_load_truncated
$aof_rewrite_incremental_fsync = $::redis::aof_rewrite_incremental_fsync
$appendfilename = $::redis::appendfilename
$appendfsync = $::redis::appendfsync
$appendonly = $::redis::appendonly
$auto_aof_rewrite_min_size = $::redis::auto_aof_rewrite_min_size
$auto_aof_rewrite_percentage = $::redis::auto_aof_rewrite_percentage
$bind = $::redis::bind
$cluster_config_file = $::redis::cluster_config_file
$cluster_enabled = $::redis::cluster_enabled
$cluster_node_timeout = $::redis::cluster_node_timeout
$daemonize = $::redis::daemonize
$databases = $::redis::databases
$dbfilename = $::redis::dbfilename
$extra_config_file = $::redis::extra_config_file
$hash_max_ziplist_entries = $::redis::hash_max_ziplist_entries
$hash_max_ziplist_value = $::redis::hash_max_ziplist_value
$hll_sparse_max_bytes = $::redis::hll_sparse_max_bytes
$hz = $::redis::hz
$latency_monitor_threshold = $::redis::latency_monitor_threshold
$list_max_ziplist_entries = $::redis::list_max_ziplist_entries
$list_max_ziplist_value = $::redis::list_max_ziplist_value
$log_file = $::redis::log_file
$log_level = $::redis::log_level
$masterauth = $::redis::masterauth
$maxclients = $::redis::maxclients
$maxmemory = $::redis::maxmemory
$maxmemory_policy = $::redis::maxmemory_policy
$maxmemory_samples = $::redis::maxmemory_samples
$min_slaves_max_lag = $::redis::min_slaves_max_lag
$min_slaves_to_write = $::redis::min_slaves_to_write
$minimum_version = $::redis::minimum_version
$no_appendfsync_on_rewrite = $::redis::no_appendfsync_on_rewrite
$notify_keyspace_events = $::redis::notify_keyspace_events
$pid_file = $::redis::pid_file
$port = $::redis::port
$rdbcompression = $::redis::rdbcompression
$repl_backlog_size = $::redis::repl_backlog_size
$repl_backlog_ttl = $::redis::repl_backlog_ttl
$repl_disable_tcp_nodelay = $::redis::repl_disable_tcp_nodelay
$repl_ping_slave_period = $::redis::repl_ping_slave_period
$repl_timeout = $::redis::repl_timeout
$requirepass = $::redis::requirepass
$save_db_to_disk = $::redis::save_db_to_disk
$save_db_to_disk_interval = $::redis::save_db_to_disk_interval
$set_max_intset_entries = $::redis::set_max_intset_entries
$slave_priority = $::redis::slave_priority
$slave_read_only = $::redis::slave_read_only
$slave_serve_stale_data = $::redis::slave_serve_stale_data
$slaveof = $::redis::slaveof
$slowlog_log_slower_than = $::redis::slowlog_log_slower_than
$slowlog_max_len = $::redis::slowlog_max_len
$stop_writes_on_bgsave_error = $::redis::stop_writes_on_bgsave_error
$syslog_enabled = $::redis::syslog_enabled
$syslog_facility = $::redis::syslog_facility
$tcp_backlog = $::redis::tcp_backlog
$tcp_keepalive = $::redis::tcp_keepalive
$timeout = $::redis::timeout
$unixsocket = $::redis::unixsocket
$unixsocketperm = $::redis::unixsocketperm
$workdir = $::redis::workdir
$zset_max_ziplist_entries = $::redis::zset_max_ziplist_entries
$zset_max_ziplist_value = $::redis::zset_max_ziplist_value

File {
owner => $::redis::config_owner,
Expand All @@ -79,28 +15,6 @@
mode => $::redis::config_dir_mode,
}

file {$::redis::config_file_orig:
ensure => file,
}

$redis_version_real = pick(getvar_emptystring('redis_server_version'), $minimum_version)

if ($redis_version_real and $::redis::conf_template == 'redis/redis.conf.erb') {
case $redis_version_real {
/^2.4./: {
File[$::redis::config_file_orig] { content => template('redis/redis.conf.2.4.10.erb') }
}
/^2.8./: {
File[$::redis::config_file_orig] { content => template('redis/redis.conf.2.8.erb') }
}
default: {
File[$::redis::config_file_orig] { content => template($::redis::conf_template) }
}
}
} else {
File[$::redis::config_file_orig] { content => template($::redis::conf_template) }
}

file {$::redis::log_dir:
ensure => directory,
group => $::redis::service_group,
Expand All @@ -115,14 +29,15 @@
owner => $::redis::service_user,
}

if $::redis::ulimit {
contain ::redis::ulimit
if $::redis::default_install {
redis::instance {'default':
pid_file => $::redis::pid_file,
manage_service_file => $::redis::manage_service_file,
}
}

exec {"cp -p ${::redis::config_file_orig} ${::redis::config_file}":
path => '/usr/bin:/bin',
subscribe => File[$::redis::config_file_orig],
refreshonly => true;
if $::redis::ulimit {
contain ::redis::ulimit
}

# Adjust /etc/default/redis-server on Debian systems
Expand Down
Loading