Showing with 28 additions and 2 deletions.
  1. +8 −0 CHANGELOG.md
  2. +6 −1 manifests/backend.pp
  3. +1 −1 metadata.json
  4. +13 −0 spec/classes/backend_spec.rb
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v5.10.1](https://github.com/sensu/sensu-puppet/tree/v5.10.1) (2023-03-01)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v5.10.0...v5.10.1)

### Fixed

- Fix catalog compile errors when API validation is disabled on backends [\#1333](https://github.com/sensu/sensu-puppet/pull/1333) ([treydock](https://github.com/treydock))

## [v5.10.0](https://github.com/sensu/sensu-puppet/tree/v5.10.0) (2023-02-27)

[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v5.9.0...v5.10.0)
Expand Down
7 changes: 6 additions & 1 deletion manifests/backend.pp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@
subscribe => $service_subscribe,
}

if $sensu::validate_api {
$init_require = Sensu_api_validator['sensu']
} else {
$init_require = undef
}
exec { 'sensu-backend init':
path => '/usr/bin:/bin:/usr/sbin:/sbin',
command => "sensu-backend init --config-file ${sensu::etc_dir}/backend.yml",
Expand All @@ -381,7 +386,7 @@
# If exit code is 3, do not need to run sensu-backend init again
# If exit is not 3, run sensu-backend init
unless => "sensu-backend init --config-file ${sensu::etc_dir}/backend.yml ; [ \$? -eq 3 ] && exit 0 || exit 1",
require => Sensu_api_validator['sensu'],
require => $init_require,
before => [
Sensu_user['admin'],
Sensuctl_configure['puppet'],
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": "sensu-sensu",
"version": "5.10.0",
"version": "5.10.1",
"author": "sensu",
"summary": "A module to install the Sensu monitoring framework",
"license": "MIT",
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,19 @@ class { '::postgresql::server': }
it { should contain_file('sensu-backend_env_vars').with_content(service_env_vars_content) }
end
end

context 'when validate_api => false' do
let(:pre_condition) do
<<-PP
class { 'sensu':
validate_api => false,
}
PP
end

it { should compile.with_all_deps }
it { is_expected.to contain_exec('sensu-backend init').without_require }
end
end
end
end
Expand Down