4 changes: 1 addition & 3 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ fixtures:
repo: 'https://github.com/puppetlabs/puppetlabs-selinux_core'
puppet_version: '>= 6.0.0'
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib'
systemd:
repo: 'https://github.com/camptocamp/puppet-systemd'
ref: '2.12.0'
systemd: 'https://github.com/camptocamp/puppet-systemd'
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jobs:
matrix:
setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}}
puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}}
pulpcore_version:
- '3.14'
name: Acceptance / ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v2
Expand All @@ -77,3 +79,7 @@ jobs:
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}
# In Puppet 7 the locale ends up being C.UTF-8 if it isn't passed.
# This locale doesn't exist in EL7 and won't be supported either.
LANG: en_US.UTF-8
BEAKER_FACTER_PULPCORE_VERSION: ${{ matrix.pulpcore_version }}
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## [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)

**Breaking changes:**

- Support 3.14, drop 3.13 [\#208](https://github.com/theforeman/puppet-pulpcore/pull/208) ([ehelms](https://github.com/ehelms))
- Support Pulp 3.13, drop earlier versions [\#202](https://github.com/theforeman/puppet-pulpcore/pull/202) ([ekohl](https://github.com/ekohl))

**Implemented enhancements:**

- Fixes [\#32968](https://projects.theforeman.org/issues/32968): Add ability to modify log level [\#212](https://github.com/theforeman/puppet-pulpcore/pull/212) ([ehelms](https://github.com/ehelms))
- Refs [\#32917](https://projects.theforeman.org/issues/32917) - Don't deploy or configure Redis with new tasking system [\#207](https://github.com/theforeman/puppet-pulpcore/pull/207) ([wbclark](https://github.com/wbclark))
- Refs [\#32910](https://projects.theforeman.org/issues/32910): Add ability to enable content caching [\#204](https://github.com/theforeman/puppet-pulpcore/pull/204) ([ehelms](https://github.com/ehelms))
- Fixes [\#32891](https://projects.theforeman.org/issues/32891) - Add feature to enable new tasking system and enable it by default [\#203](https://github.com/theforeman/puppet-pulpcore/pull/203) ([wbclark](https://github.com/wbclark))
- Support version 3.11 [\#201](https://github.com/theforeman/puppet-pulpcore/pull/201) ([ekohl](https://github.com/ekohl))
- Introduce a private socket\_service helper [\#199](https://github.com/theforeman/puppet-pulpcore/pull/199) ([ekohl](https://github.com/ekohl))
- Support Puppet 7 [\#174](https://github.com/theforeman/puppet-pulpcore/pull/174) ([ekohl](https://github.com/ekohl))

**Fixed bugs:**

- Fixes [\#32766](https://projects.theforeman.org/issues/32766) - adds scheme and pulp content path to setting value [\#200](https://github.com/theforeman/puppet-pulpcore/pull/200) ([jjeffers](https://github.com/jjeffers))

## [3.4.0](https://github.com/theforeman/puppet-pulpcore/tree/3.4.0) (2021-05-19)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/2.2.3...3.4.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ gem 'voxpupuli-test', '~> 1.4'
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet_metadata', '~> 0.3'
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
gem 'voxpupuli-acceptance', '~> 0.3', {"groups"=>["system_tests"]}
gem 'voxpupuli-acceptance', '~> 1.0', {"groups"=>["system_tests"]}

# vim:ft=ruby
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ 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.9
### Pulpcore 3.14

Recommended version. At least version 3.9.1 should be used.
Only supported version.

## Installation layout

Expand Down
4 changes: 3 additions & 1 deletion manifests/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
require => Pulpcore::Admin['migrate --noinput'],
}

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

}
20 changes: 20 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@
# 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 use_rq_tasking_system
# Use the older RQ workers tasking system instead of the newer PostgreSQL tasking system introduced in Pulpcore 3.14.
# Any benchmarking you did to optimize worker_count or other tasking related parameters will no longer be accurate after changing the tasking system.
# Do not modify this setting unless you understand the implications for performance and stability.
#
# @param service_enable
# Enable/disable Pulp services at boot.
#
Expand All @@ -155,6 +160,15 @@
# @param api_client_auth_cn_map
# Mapping of certificate common name and Pulp user to authenticate to Pulp API.
#
# @param cache_enabled
# Enables Redis based content caching within the Pulp content app.
#
# @param cache_expires_ttl
# The number of seconds that content should be cached for. Specify 'None' to never expire the cache.
#
# @param log_level
# Sets the log level.
#
# @example Default configuration
# include pulpcore
#
Expand Down Expand Up @@ -197,16 +211,22 @@
Pulpcore::ChecksumTypes $allowed_content_checksums = ['sha224', 'sha256', 'sha384', 'sha512'],
String[1] $remote_user_environ_name = 'HTTP_REMOTE_USER',
Integer[0] $worker_count = min(8, $facts['processors']['count']),
Boolean $use_rq_tasking_system = false,
Boolean $service_enable = true,
Boolean $service_ensure = true,
Integer[0] $content_service_worker_count = (2*min(8, $facts['processors']['count']) + 1),
Integer[0] $api_service_worker_count = 1,
Integer[0] $content_service_worker_timeout = 90,
Integer[0] $api_service_worker_timeout = 90,
Hash[String[1], String[1]] $api_client_auth_cn_map = {},
Boolean $cache_enabled = false,
Optional[Variant[Integer[1], Enum['None']]] $cache_expires_ttl = undef,
Enum['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'] $log_level = 'INFO',
) {
$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
10 changes: 9 additions & 1 deletion manifests/plugin/ansible.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@
],
}

if ! $pulpcore::apache_https_vhost {
fail('HTTPS must be turned on for Ansible content')
} elsif $pulpcore::apache::https_port != 443 {
$external_content_url = "https://${pulpcore::servername}:${pulpcore::apache::https_port}${pulpcore::apache::content_path}"
} else {
$external_content_url = "https://${pulpcore::servername}${pulpcore::apache::content_path}"
}

pulpcore::plugin { 'ansible':
config => "ANSIBLE_API_HOSTNAME = \"${pulpcore::servername}\"\nANSIBLE_CONTENT_HOSTNAME = \"${pulpcore::servername}\"",
config => "ANSIBLE_API_HOSTNAME = \"${pulpcore::servername}\"\nANSIBLE_CONTENT_HOSTNAME = \"${external_content_url}\"",
https_content => epp('pulpcore/apache-fragment.epp', $context),
}
}
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.9',
Pattern['^\d+\.\d+$'] $version = '3.14',
) {
$context = {
'version' => $version,
Expand Down
61 changes: 35 additions & 26 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,55 @@
# @api private
class pulpcore::service {
include apache
$socket_service_ensure = bool2str($pulpcore::service_ensure, 'running', 'stopped')

systemd::unit_file { 'pulpcore-api.socket':
content => template('pulpcore/pulpcore-api.socket.erb'),
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
pulpcore::socket_service { 'pulpcore-api':
ensure => $socket_service_ensure,
enable => $pulpcore::service_enable,
socket_content => template('pulpcore/pulpcore-api.socket.erb'),
service_content => template('pulpcore/pulpcore-api.service.erb'),
}

systemd::unit_file { 'pulpcore-api.service':
content => template('pulpcore/pulpcore-api.service.erb'),
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
pulpcore::socket_service { 'pulpcore-content':
ensure => $socket_service_ensure,
enable => $pulpcore::service_enable,
socket_content => template('pulpcore/pulpcore-content.socket.erb'),
service_content => template('pulpcore/pulpcore-content.service.erb'),
}

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

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

systemd::unit_file { 'pulpcore-resource-manager.service':
content => template('pulpcore/pulpcore-resource-manager.service.erb'),
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
if $pulpcore::use_rq_tasking_system {
systemd::unit_file { 'pulpcore-resource-manager.service':
content => template('pulpcore/pulpcore-resource-manager.service.erb'),
active => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
}
} else {
systemd::unit_file { 'pulpcore-resource-manager.service':
ensure => 'absent',
active => false,
enable => false,
}
}

systemd::unit_file { 'pulpcore-worker@.service':
content => template('pulpcore/pulpcore-worker@.service.erb'),
}

# In camptocamp/systemd 3.0.0 support for Puppet < 6.1.0 was dropped.
# This means there is no single daemon-reload class anymore. This also means
# there is no more relation that ensures all services are loaded prior to running them.
$metadata = load_module_metadata('systemd')
if SemVer($metadata['version']) >= SemVer('3.0.0') {
$reload_require = undef
} else {
$reload_require = Class['systemd::systemctl::daemon_reload']
}

Integer[1, $pulpcore::worker_count].each |$n| {
service { "pulpcore-worker@${n}.service":
ensure => $pulpcore::service_ensure,
enable => $pulpcore::service_enable,
require => Class['systemd::systemctl::daemon_reload'],
require => $reload_require,
subscribe => Systemd::Unit_file['pulpcore-worker@.service'],
}
}
Expand All @@ -53,7 +62,7 @@
service { $worker:
ensure => false,
enable => false,
require => [Systemd::Unit_file['pulpcore-worker@.service'], Class['systemd::systemctl::daemon_reload']],
require => [Systemd::Unit_file['pulpcore-worker@.service'], $reload_require],
}
}
}
Expand Down
61 changes: 61 additions & 0 deletions manifests/socket_service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# @summary Create a systemd socket activated service
# @api private
#
# Systemd socket activated services have their own dependencies. This is a
# convenience wrapper around systemd::unit_file.
#
# @param name [Pattern['^[^/]+$']]
# The target unit file to create
# @param socket_content
# The content for the socket unit file. Required if ensure isn't absent.
# @param service_content
# The content for the service unit file. Required if ensure isn't absent.
# @param enable
# Whether to enable or disable the service. By default this is derived from
# $ensure but can be overridden for advanced use cases where the service is
# running during a migration but shouldn't be enabled on boot.
define pulpcore::socket_service (
Enum['running', 'stopped', 'present', 'absent'] $ensure = 'running',
Optional[String[1]] $socket_content = undef,
Optional[String[1]] $service_content = undef,
Optional[Boolean] $enable = undef,
) {
assert_type(Pattern['^[^/]+$'], $name)

if $ensure != 'absent' {
assert_type(NotUndef, $socket_content)
assert_type(NotUndef, $service_content)
}

$active = $ensure ? {
'running' => true,
'stopped' => false,
'absent' => false,
default => undef,
}
$real_enable = pick($enable, $active)

$unit_file_ensure = bool2str($ensure == 'absent', 'absent', 'present')

systemd::unit_file { "${name}.socket":
ensure => $unit_file_ensure,
content => $socket_content,
active => $active,
enable => $real_enable,
}

systemd::unit_file { "${name}.service":
ensure => $unit_file_ensure,
content => $service_content,
active => $active,
enable => $real_enable,
}

if $active or $real_enable {
# Systemd needs both .socket and .service to be loaded when starting the
# service. The unit_file takes care of matching, this ensures the
# non-matching order.
File["/etc/systemd/system/${name}.socket"] -> Service["${name}.service"]
File["/etc/systemd/system/${name}.service"] -> Service["${name}.socket"]
}
}
8 changes: 4 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-pulpcore",
"version": "3.4.0",
"version": "4.0.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 < 7.0.0"
"version_requirement": ">= 5.0.0 < 8.0.0"
},
{
"name": "puppetlabs/apache",
Expand All @@ -28,7 +28,7 @@
},
{
"name": "camptocamp/systemd",
"version_requirement": ">= 2.2.0 < 3.0.0"
"version_requirement": ">= 2.2.0 < 4.0.0"
},
{
"name": "puppet/extlib",
Expand All @@ -54,7 +54,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 5.5.8 < 7.0.0"
"version_requirement": ">= 5.5.8 < 8.0.0"
}
]
}
Loading