Skip to content

Commit

Permalink
Merge pull request #37 from hubspotdevops/redis_version_override
Browse files Browse the repository at this point in the history
the redis_version fact isn't always accurate on the first Puppet run.
  • Loading branch information
fsalum committed Aug 18, 2014
2 parents 84b4c41 + b1ad409 commit 138c68f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 13 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
$conf_zset_max_ziplist_value = '64', # 2.4+
$package_ensure = 'present',
$package_name = undef,
$redis_version_override = undef,
$service_enable = true,
$service_ensure = 'running',
$service_restart = true,
Expand All @@ -111,6 +112,18 @@
$conf_logrotate = $redis::params::conf_logrotate
$service = $redis::params::service

if $redis_version_override {
$redis_version_real = $redis_version_override
} else {
$redis_version_real = $package_ensure ? {
/2\.2\..*/ => '2.2.x',
/2\.4\..*/ => '2.4.x',
/2\.6\..*/ => '2.6.x',
/2\.8\..*/ => '2.8.x',
default => $::redis_version
}
}

if $package_name {
$package = $package_name
}else{
Expand Down
8 changes: 4 additions & 4 deletions templates/redis.conf.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%- if @redis_version == "2.2.x" -%>
<%- if @redis_version_real == "2.2.x" -%>
# MANAGED BY PUPPET #
#
# Redis 2.2 configuration file example
Expand Down Expand Up @@ -545,7 +545,7 @@ include <%= include %><%= "\n" -%>
<%- end -%>
<%- end -%>
<%- end -%>
<%- if @redis_version == "2.4.x" -%>
<%- if @redis_version_real == "2.4.x" -%>
# MANAGED BY PUPPET #
#
# Redis 2.4 configuration file example
Expand Down Expand Up @@ -1174,7 +1174,7 @@ include <%= include %><%= "\n" -%>
<%- end -%>
<%- end -%>
<%- end -%>
<%- if @redis_version == "2.6.x" -%>
<%- if @redis_version_real == "2.6.x" -%>
# MANAGED BY PUPPET #
#
# Redis 2.6 configuration file example
Expand Down Expand Up @@ -1903,7 +1903,7 @@ include <%= include %><%= "\n" -%>
<%- end -%>
<%- end -%>
<%- end -%>
<%- if @redis_version == "2.8.x" -%>
<%- if @redis_version_real == "2.8.x" -%>
# MANAGED BY PUPPET #
#
# Redis 2.8 configuration file example
Expand Down

0 comments on commit 138c68f

Please sign in to comment.