Showing with 75 additions and 4 deletions.
  1. +9 −0 CHANGELOG.md
  2. +2 −2 README.md
  3. +5 −0 manifests/init.pp
  4. +2 −2 metadata.json
  5. +51 −0 spec/acceptance/settings_spec.rb
  6. +6 −0 templates/settings.py.erb
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [8.2.0](https://github.com/theforeman/puppet-pulpcore/tree/8.2.0) (2023-06-20)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/8.1.0...8.2.0)

**Implemented enhancements:**

- allow configuring HIDE\_GUARDED\_DISTRIBUTIONS setting [\#292](https://github.com/theforeman/puppet-pulpcore/pull/292) ([evgeni](https://github.com/evgeni))
- allow puppet/redis 9.x [\#291](https://github.com/theforeman/puppet-pulpcore/pull/291) ([evgeni](https://github.com/evgeni))

## [8.1.0](https://github.com/theforeman/puppet-pulpcore/tree/8.1.0) (2023-05-26)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/8.0.0...8.1.0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Default recommended version.

### Pulpcore 3.21

Supported version
Supported version. The parameter `$hide_guarded_distributions` doesn't work since it's a Pulp 3.22 feature.

### Pulpcore 3.16 - 3.18

Untested, but should work. Not recommended.
Untested, but should work besides the `$hide_guarded_distributions` parameter. Not recommended.

## Installation layout

Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@
# if undef, it will instead be omitted from settings.yml and Pulp will report these usage statistics per its default behavior.
# Adding this configuration will have no effect in Pulp versions prior to the introduction of the telemetry feature.
#
# @param hide_guarded_distributions
# If activated, the distributions that are protected by a content guard will not be shown on the
# directory listing in the content app.
#
# @example Default configuration
# include pulpcore
#
Expand Down Expand Up @@ -247,6 +251,7 @@
Pulpcore::LogLevel $log_level = 'INFO',
Hash[String[1], Pulpcore::Logger] $loggers = {},
Optional[Boolean] $telemetry = undef,
Optional[Boolean] $hide_guarded_distributions = undef,
) {
$settings_file = "${config_dir}/settings.py"
$certs_dir = "${config_dir}/certs"
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-pulpcore",
"version": "8.1.0",
"version": "8.2.0",
"author": "theforeman",
"summary": "Installs next generation Pulp server",
"license": "GPL-3.0-or-later",
Expand All @@ -16,7 +16,7 @@
},
{
"name": "puppet/redis",
"version_requirement": ">= 5.0.0 < 9.0.0"
"version_requirement": ">= 5.0.0 < 10.0.0"
},
{
"name": "puppetlabs/apache",
Expand Down
51 changes: 51 additions & 0 deletions spec/acceptance/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,54 @@ class { 'pulpcore':
end
end
end

describe 'HIDE_GUARDED_DISTRIBUTIONS setting' do
context 'default HIDE_GUARDED_DISTRIBUTIONS' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
include pulpcore
PUPPET
end
end

describe file('/etc/pulp/settings.py') do
it { is_expected.to be_file }
its(:content) { is_expected.to match(/^# HIDE_GUARDED_DISTRIBUTIONS = False$/) }
end
end

context 'HIDE_GUARDED_DISTRIBUTIONS disabled' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'pulpcore':
hide_guarded_distributions => false,
}
PUPPET
end
end

describe file('/etc/pulp/settings.py') do
it { is_expected.to be_file }
its(:content) { is_expected.to match(/^HIDE_GUARDED_DISTRIBUTIONS = False$/) }
end
end

context 'HIDE_GUARDED_DISTRIBUTIONS enabled' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'pulpcore':
hide_guarded_distributions => true,
}
PUPPET
end
end

describe file('/etc/pulp/settings.py') do
it { is_expected.to be_file }
its(:content) { is_expected.to match(/^HIDE_GUARDED_DISTRIBUTIONS = True$/) }
end
end
end
6 changes: 6 additions & 0 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ CACHE_SETTINGS = {
'EXPIRES_TTL': <%= scope['pulpcore::cache_expires_ttl'] %>,
}
<% end -%>
<% if scope['pulpcore::hide_guarded_distributions'].nil? -%>
# HIDE_GUARDED_DISTRIBUTIONS = False
<% else -%>
HIDE_GUARDED_DISTRIBUTIONS = <%= scope.call_function('to_python', [scope['pulpcore::hide_guarded_distributions']]) %>
<% end -%>