Showing with 17 additions and 88 deletions.
  1. +8 −0 CHANGELOG.md
  2. +1 −3 manifests/database.pp
  3. +0 −2 manifests/init.pp
  4. +1 −1 metadata.json
  5. +3 −18 spec/acceptance/basic_spec.rb
  6. +4 −61 spec/classes/pulpcore_spec.rb
  7. +0 −3 templates/settings.py.erb
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [4.0.1](https://github.com/theforeman/puppet-pulpcore/tree/4.0.1) (2021-07-13)

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

**Fixed bugs:**

- Revert "Refs [\#32917](https://projects.theforeman.org/issues/32917) - Don't deploy or configure Redis with new taskin… [\#217](https://github.com/theforeman/puppet-pulpcore/pull/217) ([ehelms](https://github.com/ehelms))

## [4.0.0](https://github.com/theforeman/puppet-pulpcore/tree/4.0.0) (2021-07-12)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/3.4.0...4.0.0)
Expand Down
4 changes: 1 addition & 3 deletions manifests/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
require => Pulpcore::Admin['migrate --noinput'],
}

if $pulpcore::uses_redis {
include redis
}
include redis

}
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@
) {
$settings_file = "${config_dir}/settings.py"

$uses_redis = $use_rq_tasking_system or $cache_enabled

contain pulpcore::install
contain pulpcore::database
contain pulpcore::config
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": "theforeman-pulpcore",
"version": "4.0.0",
"version": "4.0.1",
"author": "theforeman",
"summary": "Installs next generation Pulp server",
"license": "GPL-3.0-or-later",
Expand Down
21 changes: 3 additions & 18 deletions spec/acceptance/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,10 @@ class { 'pulpcore':
its(:exit_status) { is_expected.to eq 0 }
end

describe service('rh-redis5-redis'), if: %w[centos redhat].include?(os[:family]) && os[:release].to_i == 7 do
it { is_expected.not_to be_running }
it { is_expected.not_to be_enabled }
end

describe service('redis'), unless: %w[centos redhat].include?(os[:family]) && os[:release].to_i == 7 do
it { is_expected.not_to be_running }
it { is_expected.not_to be_enabled }
end

describe command("DJANGO_SETTINGS_MODULE=pulpcore.app.settings PULP_SETTINGS=/etc/pulp/settings.py rq info -c pulpcore.rqconfig") do
its(:stdout) { is_expected.not_to match(/Connection refused/) }
its(:exit_status) { is_expected.to eq 1 }
its(:stdout) { is_expected.to match(/^0 workers, /) }
its(:stdout) { is_expected.not_to match(/^resource-manager /) }
its(:exit_status) { is_expected.to eq 0 }
end
end

Expand Down Expand Up @@ -183,12 +174,6 @@ class { 'pulpcore':
it { is_expected.to be_enabled }
end

describe command("DJANGO_SETTINGS_MODULE=pulpcore.app.settings PULP_SETTINGS=/etc/pulp/settings.py rq info -c pulpcore.rqconfig") do
its(:stdout) { is_expected.to match(/^0 workers, /) }
its(:stdout) { is_expected.not_to match(/^resource-manager /) }
its(:exit_status) { is_expected.to eq 0 }
end

describe curl_command("https://#{host_inventory['fqdn']}/pulp/api/v3/status/", cacert: "#{certdir}/ca-cert.pem") do
its(:response_code) { is_expected.to eq(200) }
its(:exit_status) { is_expected.to eq 0 }
Expand Down
65 changes: 4 additions & 61 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
.with_content(%r{ALLOWED_IMPORT_PATHS = \["/var/lib/pulp/sync_imports"\]})
.with_content(%r{ALLOWED_CONTENT_CHECKSUMS = \["sha224", "sha256", "sha384", "sha512"\]})
.with_content(%r{\s'level': 'INFO',})
.with_content(%r{CACHE_ENABLED = False})
.without_content(%r{sslmode})
is_expected.to contain_file('/etc/pulp')
is_expected.to contain_file('/var/lib/pulp')
Expand All @@ -41,7 +42,7 @@
is_expected.to contain_exec('pulpcore-manager collectstatic --noinput')
end

it 'configures the PostgreSQL database' do
it 'configures the database' do
is_expected.to contain_class('pulpcore::database')
is_expected.to contain_class('postgresql::server')
is_expected.to contain_postgresql__server__db('pulpcore')
Expand All @@ -51,30 +52,6 @@
is_expected.to contain_exec('pulpcore-manager reset-admin-password --random')
end

it 'does not install Redis' do
is_expected.not_to contain_class('redis')
end

it 'does not configure Pulpcore connection to Redis' do
is_expected.to contain_concat__fragment('base')
.without_content(%r{REDIS_HOST})
.without_content(%r{REDIS_POST})
.without_content(%r{REDIS_DB})
end

it 'does not configure content caching' do
is_expected.to contain_concat__fragment('base')
.with_content(/CACHE_ENABLED = False/)
.without_content(%r{CACHE_SETTINGS})
.without_content(%r{'EXPIRES_TTL':})
end

it 'configures pulpcore to use PostgreSQL tasking system' do
is_expected.to contain_concat__fragment('base')
.with_content(%r{USE_NEW_WORKER_TYPE = True})
is_expected.to contain_systemd__unit_file('pulpcore-resource-manager.service').with_ensure('absent')
end

it 'configures apache' do
is_expected.to contain_class('pulpcore::apache')
is_expected.to contain_apache__vhost('pulpcore')
Expand Down Expand Up @@ -152,6 +129,7 @@
is_expected.to contain_systemd__unit_file('pulpcore-content.socket')
is_expected.to contain_systemd__unit_file('pulpcore-content.service')
is_expected.to contain_file('/etc/systemd/system/pulpcore-content.socket').that_comes_before('Service[pulpcore-content.service]')
is_expected.to contain_systemd__unit_file('pulpcore-resource-manager.service').with_ensure('absent')
is_expected.to contain_systemd__unit_file('pulpcore-worker@.service')
is_expected.to contain_service("pulpcore-worker@1.service").with_ensure(true)
is_expected.not_to contain_service("pulpcore-worker@2.service")
Expand Down Expand Up @@ -514,46 +492,11 @@
}
end

it 'configures content caching' do
it do
is_expected.to contain_concat__fragment('base')
.with_content(%r{CACHE_ENABLED = True})
.with_content(%r{CACHE_SETTINGS = \{\n 'EXPIRES_TTL': 60,\n\}})
end

it 'installs Redis' do
is_expected.to contain_class('redis')
end

it 'configures Pulpcore connection to Redis' do
is_expected.to contain_concat__fragment('base')
.with_content(%r{REDIS_HOST})
.with_content(%r{REDIS_PORT})
.with_content(%r{REDIS_DB})
end
end

context 'can enable RQ tasking system' do
let :params do
{
use_rq_tasking_system: true,
}
end

it 'configures RQ tasking system' do
is_expected.to contain_concat__fragment('base')
.with_content(%r{USE_NEW_WORKER_TYPE = False})
end

it 'installs Redis' do
is_expected.to contain_class('redis')
end

it 'configures Pulpcore connection to Redis' do
is_expected.to contain_concat__fragment('base')
.with_content(%r{REDIS_HOST})
.with_content(%r{REDIS_PORT})
.with_content(%r{REDIS_DB})
end
end

context 'can change the log level to DEBUG' do
Expand Down
3 changes: 0 additions & 3 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ DATABASES = {
<% end -%>
},
}

<% if scope['pulpcore::uses_redis'] -%>
REDIS_HOST = "localhost"
REDIS_PORT = "<%= scope['redis::port'] %>"
REDIS_DB = <%= scope['pulpcore::redis_db'] %>

<% end -%>
USE_NEW_WORKER_TYPE = <%= scope['pulpcore::use_rq_tasking_system'] ? "False" : "True" %>

MEDIA_ROOT = "<%= scope['pulpcore::media_root'] %>"
Expand Down