Showing with 35 additions and 10 deletions.
  1. +8 −0 CHANGELOG.md
  2. +1 −1 REFERENCE.md
  3. +4 −2 manifests/sentinel.pp
  4. +1 −1 metadata.json
  5. +21 −6 spec/classes/redis_sentinel_spec.rb
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v8.1.1](https://github.com/voxpupuli/puppet-redis/tree/v8.1.1) (2021-08-30)

[Full Changelog](https://github.com/voxpupuli/puppet-redis/compare/v8.1.0...v8.1.1)

**Fixed bugs:**

- Honor redis::sentinel::package\_ensure [\#413](https://github.com/voxpupuli/puppet-redis/pull/413) ([kajinamit](https://github.com/kajinamit))

## [v8.1.0](https://github.com/voxpupuli/puppet-redis/tree/v8.1.0) (2021-08-29)

[Full Changelog](https://github.com/voxpupuli/puppet-redis/compare/v8.0.0...v8.1.0)
Expand Down
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ Data type: `String[1]`

Do we ensure this package.

Default value: `'present'`
Default value: `'installed'`

##### <a name="parallel_sync"></a>`parallel_sync`

Expand Down
6 changes: 4 additions & 2 deletions manifests/sentinel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
Stdlib::Port $redis_port = 6379,
Optional[String[1]] $requirepass = undef,
String[1] $package_name = $redis::params::sentinel_package_name,
String[1] $package_ensure = 'present',
String[1] $package_ensure = 'installed',
Integer[0] $parallel_sync = 1,
Stdlib::Absolutepath $pid_file = $redis::params::sentinel_pid_file,
Integer[1] $quorum = 2,
Expand All @@ -147,7 +147,9 @@

require 'redis'

ensure_packages([$package_name])
ensure_packages([$package_name], {
ensure => $package_ensure
})
Package[$package_name] -> File[$config_file_orig]

$sentinel_bind_arr = delete_undef_values([$sentinel_bind].flatten)
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-redis",
"version": "8.1.0",
"version": "8.1.1",
"author": "Vox Pupuli",
"summary": "Redis module",
"license": "Apache-2.0",
Expand Down
27 changes: 21 additions & 6 deletions spec/classes/redis_sentinel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
end
end

let(:sentinel_package_name) do
if facts[:os]['family'] == 'Debian'
'redis-sentinel'
else
'redis'
end
end

describe 'without parameters' do
let(:expected_content) do
<<CONFIG
Expand Down Expand Up @@ -64,14 +72,18 @@
with_enable('true')
}

if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_package('redis-sentinel').with_ensure('installed') }
else
it { is_expected.not_to contain_package('redis-sentinel') }
end
it { is_expected.to contain_package(sentinel_package_name).with_ensure('installed') }
end

describe 'with custom parameters' do
let(:pre_condition) do
<<-PUPPET
class { 'redis':
package_ensure => 'latest',
}
PUPPET
end

let(:params) do
{
auth_pass: 'password',
Expand All @@ -83,7 +95,8 @@
log_file: '/tmp/barn-sentinel.log',
failover_timeout: 28_000,
notification_script: '/path/to/bar.sh',
client_reconfig_script: '/path/to/foo.sh'
client_reconfig_script: '/path/to/foo.sh',
package_ensure: 'latest'
}
end

Expand Down Expand Up @@ -112,6 +125,8 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to create_class('redis::sentinel') }
it { is_expected.to contain_file(config_file_orig).with_content(expected_content) }

it { is_expected.to contain_package(sentinel_package_name).with_ensure('latest') }
end

describe 'with array sentinel bind' do
Expand Down