Showing with 155 additions and 39 deletions.
  1. +6 −1 .github/workflows/acceptance.yml
  2. +7 −2 .github/workflows/cron.yml
  3. +10 −0 CHANGELOG.md
  4. +10 −9 Gemfile
  5. +10 −0 HISTORY.md
  6. +4 −0 README.md
  7. +8 −0 manifests/init.pp
  8. +29 −1 manifests/plugin/deb.pp
  9. +1 −1 manifests/repo.pp
  10. +13 −13 manifests/service.pp
  11. +1 −1 metadata.json
  12. +13 −0 spec/classes/plugin_deb_spec.rb
  13. +43 −11 spec/classes/pulpcore_spec.rb
7 changes: 6 additions & 1 deletion .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
bundle config path vendor/bundle
bundle config without 'development test'
bundle install --jobs 4 --retry 3
acceptance:
needs: build_cache
runs-on: ubuntu-latest
Expand All @@ -35,7 +36,10 @@ jobs:
puppet:
- "6"
- "5"
name: Puppet ${{ matrix.puppet }} - ${{ matrix.setfile }}
pulpcore_version:
- '3.6'
- '3.7'
name: Puppet ${{ matrix.puppet }} - Pulp ${{ matrix.pulpcore_version }} - ${{ matrix.setfile }}
steps:
- name: Enable IPv6 on docker
run: |
Expand Down Expand Up @@ -63,3 +67,4 @@ jobs:
env:
BEAKER_PUPPET_COLLECTION: puppet${{ matrix.puppet }}
BEAKER_setfile: ${{ matrix.setfile }}
BEAKER_FACTER_PULPCORE_VERSION: ${{ matrix.pulpcore_version }}
9 changes: 7 additions & 2 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Nightly tests

on:
schedule:
- cron: '4 * * * *'
- cron: '4 4 * * *'

jobs:
unit:
Expand Down Expand Up @@ -71,6 +71,7 @@ jobs:
bundle config path vendor/bundle
bundle config without 'development test'
bundle install --jobs 4 --retry 3
acceptance:
if: github.repository == 'theforeman/puppet-pulpcore'
needs: build_cache
Expand All @@ -84,7 +85,10 @@ jobs:
puppet:
- "6"
- "5"
name: Puppet ${{ matrix.puppet }} - ${{ matrix.setfile }}
pulpcore_version:
- '3.6'
- '3.7'
name: Puppet ${{ matrix.puppet }} - Pulp ${{ matrix.pulpcore_version }} - ${{ matrix.setfile }}
steps:
- name: Enable IPv6 on docker
run: |
Expand Down Expand Up @@ -112,3 +116,4 @@ jobs:
env:
BEAKER_PUPPET_COLLECTION: puppet${{ matrix.puppet }}
BEAKER_setfile: ${{ matrix.setfile }}
BEAKER_FACTER_PULPCORE_VERSION: ${{ matrix.pulpcore_version }}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [2.1.0](https://github.com/theforeman/puppet-pulpcore/tree/2.1.0) (2020-11-11)

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

**Implemented enhancements:**

- support /pulp/deb proxying [\#145](https://github.com/theforeman/puppet-pulpcore/pull/145) ([jlsherrill](https://github.com/jlsherrill))
- Add ability to control if services are enabled or active [\#137](https://github.com/theforeman/puppet-pulpcore/pull/137) ([ehelms](https://github.com/ehelms))
- Support Pulpcore 3.7 [\#127](https://github.com/theforeman/puppet-pulpcore/pull/127) ([ekohl](https://github.com/ekohl))

## [2.0.0](https://github.com/theforeman/puppet-pulpcore/tree/2.0.0) (2020-10-29)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/1.2.1...2.0.0)
Expand Down
19 changes: 10 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@

source 'https://rubygems.org'

gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '>= 5.5'
gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '>= 5.5', groups: ['development', 'test']
gem 'rake'

gem 'kafo_module_lint'
gem 'puppet-lint-empty_string-check'
gem 'puppet-lint-file_ensure-check'
gem 'puppet-lint-param-docs', '>= 1.3.0'
gem 'puppet-lint-spaceship_operator_without_tag-check'
gem 'puppet-lint-strict_indent-check'
gem 'puppet-lint-undef_in_function-check'
gem 'kafo_module_lint', {"groups"=>["test"]}
gem 'puppet-lint-empty_string-check', {"groups"=>["test"]}
gem 'puppet-lint-file_ensure-check', {"groups"=>["test"]}
gem 'puppet-lint-param-docs', '>= 1.3.0', {"groups"=>["test"]}
gem 'puppet-lint-spaceship_operator_without_tag-check', {"groups"=>["test"]}
gem 'puppet-lint-strict_indent-check', {"groups"=>["test"]}
gem 'puppet-lint-undef_in_function-check', {"groups"=>["test"]}
gem 'voxpupuli-test', '~> 1.4'
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
gem 'voxpupuli-acceptance', '~> 0.2', {"groups"=>["system_tests"]}
gem 'voxpupuli-acceptance', '~> 0.3', {"groups"=>["system_tests"]}

# vim:ft=ruby
10 changes: 10 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [2.1.0](https://github.com/theforeman/puppet-pulpcore/tree/2.1.0) (2020-11-11)

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

**Implemented enhancements:**

- support /pulp/deb proxying [\#145](https://github.com/theforeman/puppet-pulpcore/pull/145) ([jlsherrill](https://github.com/jlsherrill))
- Add ability to control if services are enabled or active [\#137](https://github.com/theforeman/puppet-pulpcore/pull/137) ([ehelms](https://github.com/ehelms))
- Support Pulpcore 3.7 [\#127](https://github.com/theforeman/puppet-pulpcore/pull/127) ([ekohl](https://github.com/ekohl))

## [2.0.0](https://github.com/theforeman/puppet-pulpcore/tree/2.0.0) (2020-10-29)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/1.2.1...2.0.0)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ All supported versions are listed below. For every supported version, acceptance

Supported operating systems are listed in `metadata.json` but individual releases can divert from that. For example, if Pulpcore x.y drops EL7, it will still be listed in metadata.json until all versions supported by the module have dropped it. Similarly, if x.z adds support for EL9, it'll be listed in `metadata.json` and all versions that don't support EL9 will have a note.

### Pulpcore 3.7

Recommended version.

### Pulpcore 3.6

Due to the use of libexec wrappers, at least python3-pulpcore 3.6.3-2 must be installed.
Expand Down
8 changes: 8 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
# available, likely results in performance degradation due to I/O blocking and is not recommended in most cases. Modifying this parameter should
# be done incrementally with benchmarking at each step to determine an optimal value for your deployment.
#
# @param service_enable
# Enable/disable Pulp services at boot.
#
# @param service_ensure
# Specify if Pulp services should be running or stopped.
#
# @example Default configuration
# include pulpcore
#
Expand Down Expand Up @@ -171,6 +177,8 @@
Array[Stdlib::Absolutepath] $allowed_import_path = ['/var/lib/pulp/sync_imports'],
String[1] $remote_user_environ_name = 'HTTP_REMOTE_USER',
Integer[0] $worker_count = min(8, $facts['processors']['count']),
Boolean $service_enable = true,
Boolean $service_ensure = true,
) {
$settings_file = "${config_dir}/settings.py"

Expand Down
30 changes: 29 additions & 1 deletion manifests/plugin/deb.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# @summary Pulp Deb plugin
class pulpcore::plugin::deb {
# @param use_pulp2_content_route Whether to redirect the legacy (Pulp 2) URL, /pulp/deb/, to the content server
class pulpcore::plugin::deb (
Boolean $use_pulp2_content_route = false,
) {
if $use_pulp2_content_route {
$context = {
'directories' => [
{
'provider' => 'location',
'path' => '/pulp/deb',
'proxy_pass' => [
{
'url' => $pulpcore::apache::content_url,
},
],
'request_headers' => [
'unset X-CLIENT-CERT',
'set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT',
],
},
],
}
$content = epp('pulpcore/apache-fragment.epp', $context)
} else {
$content = undef
}

pulpcore::plugin { 'deb':
http_content => $content,
https_content => $content,
}
}
2 changes: 1 addition & 1 deletion manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @param version
# The Pulpcore version to use
class pulpcore::repo (
Pattern['^\d+\.\d+$'] $version = '3.6',
Pattern['^\d+\.\d+$'] $version = '3.7',
) {
$context = {
'version' => $version,
Expand Down
26 changes: 13 additions & 13 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@

systemd::unit_file { 'pulpcore-api.socket':
content => template('pulpcore/pulpcore-api.socket.erb'),
active => true,
enable => true,
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
}

systemd::unit_file { 'pulpcore-api.service':
content => template('pulpcore/pulpcore-api.service.erb'),
active => true,
enable => true,
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
}

systemd::unit_file { 'pulpcore-content.socket':
content => template('pulpcore/pulpcore-content.socket.erb'),
active => true,
enable => true,
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
}

systemd::unit_file { 'pulpcore-content.service':
content => template('pulpcore/pulpcore-content.service.erb'),
active => true,
enable => true,
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
}

systemd::unit_file { 'pulpcore-resource-manager.service':
content => template('pulpcore/pulpcore-resource-manager.service.erb'),
active => true,
enable => true,
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
}

systemd::unit_file { 'pulpcore-worker@.service':
Expand All @@ -39,8 +39,8 @@

Integer[1, $pulpcore::worker_count].each |$n| {
service { "pulpcore-worker@${n}.service":
ensure => running,
enable => true,
ensure => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
require => Class['systemd::systemctl::daemon_reload'],
subscribe => Systemd::Unit_file['pulpcore-worker@.service'],
}
Expand All @@ -51,7 +51,7 @@
$existing_workers.each |$worker| {
if $worker =~ /^pulpcore-worker@\d+\.service$/ and !defined(Service[$worker]) {
service { $worker:
ensure => stopped,
ensure => false,
enable => false,
require => [Systemd::Unit_file['pulpcore-worker@.service'], Class['systemd::systemctl::daemon_reload']],
}
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": "2.0.0",
"version": "2.1.0",
"author": "theforeman",
"summary": "Installs next generation Pulp server",
"license": "GPL-3.0-or-later",
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/plugin_deb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_pulpcore__plugin('deb') }
it { is_expected.to contain_package('python3-pulp-deb') }
it { is_expected.not_to contain_apache__vhost__fragment('pulpcore-http-plugin-deb') }
it { is_expected.not_to contain_apache__vhost__fragment('pulpcore-https-plugin-deb') }

context 'with pulpcore' do
let(:pre_condition) { 'include pulpcore' }
Expand All @@ -18,6 +20,17 @@
.that_subscribes_to('Class[Pulpcore::Install]')
.that_notifies(['Class[Pulpcore::Database]', 'Class[Pulpcore::Service]'])
end

context 'with pulp2 content route' do
let(:params) { { use_pulp2_content_route: true } }

it 'contains the Apache fragment' do
is_expected.to compile.with_all_deps
is_expected.to contain_pulpcore__apache__fragment('plugin-deb')
is_expected.to contain_apache__vhost__fragment('pulpcore-http-plugin-deb')
is_expected.to contain_apache__vhost__fragment('pulpcore-https-plugin-deb')
end
end
end
end
end
Expand Down
54 changes: 43 additions & 11 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
is_expected.to contain_class('pulpcore::service')
is_expected.to contain_systemd__unit_file('pulpcore-resource-manager.service')
is_expected.to contain_systemd__unit_file('pulpcore-worker@.service')
is_expected.to contain_service("pulpcore-worker@1.service").with_ensure('running')
is_expected.to contain_service("pulpcore-worker@1.service").with_ensure(true)
is_expected.not_to contain_service("pulpcore-worker@2.service")
end
end
Expand All @@ -124,12 +124,12 @@
is_expected.to compile.with_all_deps
(1..5).each do |n|
is_expected.to contain_service("pulpcore-worker@#{n}.service")
.with_ensure('running')
.with_enable('true')
.with_ensure(true)
.with_enable(true)
end
is_expected.to contain_service('pulpcore-worker@6.service')
.with_ensure('stopped')
.with_enable('false')
.with_ensure(false)
.with_enable(false)
end
end

Expand All @@ -140,8 +140,8 @@
is_expected.to compile.with_all_deps
(1..5).each do |n|
is_expected.to contain_service("pulpcore-worker@#{n}.service")
.with_ensure('running')
.with_enable('true')
.with_ensure(true)
.with_enable(true)
end
is_expected.not_to contain_service('pulpcore-worker@6.service')
end
Expand All @@ -154,8 +154,8 @@
is_expected.to compile.with_all_deps
(1..5).each do |n|
is_expected.to contain_service("pulpcore-worker@#{n}.service")
.with_ensure('running')
.with_enable('true')
.with_ensure(true)
.with_enable(true)
end
is_expected.not_to contain_service('pulpcore-worker@6.service')
end
Expand All @@ -166,8 +166,8 @@
is_expected.to compile.with_all_deps
(1..5).each do |n|
is_expected.to contain_service("pulpcore-worker@#{n}.service")
.with_ensure('running')
.with_enable('true')
.with_ensure(true)
.with_enable(true)
end
is_expected.not_to contain_service('pulpcore-worker@6.service')
end
Expand Down Expand Up @@ -368,6 +368,38 @@
.with_content(%r{STATIC_ROOT = "/my/other/custom/directory"})
end
end

context 'can disable services' do
let :params do
{
service_enable: false
}
end

it do
is_expected.to contain_systemd__unit_file("pulpcore-api.socket").with_enable(false)
is_expected.to contain_systemd__unit_file("pulpcore-api.service").with_enable(false)
is_expected.to contain_systemd__unit_file("pulpcore-content.service").with_enable(false)
is_expected.to contain_systemd__unit_file("pulpcore-content.socket").with_enable(false)
is_expected.to contain_service("pulpcore-worker@1.service").with_enable(false)
end
end

context 'can ensure services are stopped' do
let :params do
{
service_ensure: false
}
end

it do
is_expected.to contain_systemd__unit_file("pulpcore-api.socket").with_active(false)
is_expected.to contain_systemd__unit_file("pulpcore-api.service").with_active(false)
is_expected.to contain_systemd__unit_file("pulpcore-content.service").with_active(false)
is_expected.to contain_systemd__unit_file("pulpcore-content.socket").with_active(false)
is_expected.to contain_service("pulpcore-worker@1.service").with_ensure(false)
end
end
end
end
end