9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [3.3.0](https://github.com/theforeman/puppet-pulpcore/tree/3.3.0) (2021-04-21)

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

**Implemented enhancements:**

- Fixes [\#31950](https://projects.theforeman.org/issues/31950) - support ansible plugin [\#184](https://github.com/theforeman/puppet-pulpcore/pull/184) ([jlsherrill](https://github.com/jlsherrill))
- Add support for ALLOWED\_CONTENT\_CHECKSUMS [\#183](https://github.com/theforeman/puppet-pulpcore/pull/183) ([jlsherrill](https://github.com/jlsherrill))

## [3.2.1](https://github.com/theforeman/puppet-pulpcore/tree/3.2.1) (2021-04-15)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/3.2.0...3.2.1)
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
# @param allowed_export_path
# Allowed paths that pulp can use for content exports
#
# @param allowed_content_checksums
# List of checksum types to allow for content operations
#
# @param worker_count
# Number of pulpcore workers. Defaults to 8 or the number of CPU cores, whichever is smaller. Enabling more than 8 workers, even with additional CPU cores
# available, likely results in performance degradation due to I/O blocking and is not recommended in most cases. Modifying this parameter should
Expand Down Expand Up @@ -188,6 +191,7 @@
Stdlib::Fqdn $servername = $facts['networking']['fqdn'],
Array[Stdlib::Absolutepath] $allowed_import_path = ['/var/lib/pulp/sync_imports'],
Array[Stdlib::Absolutepath] $allowed_export_path = [],
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 $service_enable = true,
Expand Down
22 changes: 22 additions & 0 deletions manifests/plugin/ansible.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# @summary Pulp Ansible plugin
# @param ansible_galaxy_path
# In the Apache configuration the path to forward to the api app
# for ansible galaxy support
class pulpcore::plugin::ansible(
String $ansible_galaxy_path = '/pulp_ansible/galaxy/',
) {
$context = {
'directories' => [],
'proxy_pass' => [
{
'path' => $ansible_galaxy_path,
'url' => "${pulpcore::apache::api_base_url}${ansible_galaxy_path}",
},
],
}

pulpcore::plugin { 'ansible':
config => "ANSIBLE_API_HOSTNAME = \"${pulpcore::servername}\"\nANSIBLE_CONTENT_HOSTNAME = \"${pulpcore::servername}\"",
https_content => epp('pulpcore/apache-fragment.epp', $context),
}
}
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": "3.2.1",
"version": "3.3.0",
"author": "theforeman",
"summary": "Installs next generation Pulp server",
"license": "GPL-3.0-or-later",
Expand Down
1 change: 1 addition & 0 deletions spec/acceptance/plugins_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class { 'pulpcore':
apache_https_key => '#{certdir}/ca-key.pem',
apache_https_ca => '#{certdir}/ca-cert.pem',
}
include pulpcore::plugin::ansible
include pulpcore::plugin::certguard
include pulpcore::plugin::container
include pulpcore::plugin::deb
Expand Down
32 changes: 32 additions & 0 deletions spec/classes/plugin_ansible_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'spec_helper'

describe 'pulpcore::plugin::ansible' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
let(:pre_condition) { 'include pulpcore' }
let(:expected_vhost_content) do
<<CONTENT
ProxyPass /pulp_ansible/galaxy/ unix:///run/pulpcore-api.sock|http://pulpcore-api/pulp_ansible/galaxy/
ProxyPassReverse /pulp_ansible/galaxy/ unix:///run/pulpcore-api.sock|http://pulpcore-api/pulp_ansible/galaxy/
CONTENT
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('python3-pulp-ansible') }
it { is_expected.to contain_pulpcore__plugin('ansible') }
it do
is_expected.to compile.with_all_deps
is_expected.to contain_pulpcore__plugin('ansible')
.that_subscribes_to('Class[Pulpcore::Install]')
.that_notifies(['Class[Pulpcore::Database]', 'Class[Pulpcore::Service]'])
is_expected.to contain_apache__vhost__fragment('pulpcore-https-plugin-ansible')
.with_content(expected_vhost_content)
is_expected.to contain_concat__fragment('plugin-ansible')
.with_content(/^ANSIBLE_API_HOSTNAME = "foo.example.com"/)
.with_content(/^ANSIBLE_CONTENT_HOSTNAME = "foo.example.com"/)
end
end
end
end
1 change: 1 addition & 0 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
is_expected.to contain_concat__fragment('base')
.with_content(%r{ALLOWED_EXPORT_PATHS = \[\]})
.with_content(%r{ALLOWED_IMPORT_PATHS = \["/var/lib/pulp/sync_imports"\]})
.with_content(%r{ALLOWED_CONTENT_CHECKSUMS = \["sha224", "sha256", "sha384", "sha512"\]})
.without_content(/sslmode/)
is_expected.to contain_file('/etc/pulp')
is_expected.to contain_file('/var/lib/pulp')
Expand Down
3 changes: 3 additions & 0 deletions spec/setup_acceptance_node.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
package { 'glibc-langpack-en':
ensure => installed,
}
package { 'centos-release-ansible-29':
ensure => present,
}
}
default: {}
}
Expand Down
8 changes: 8 additions & 0 deletions spec/type_aliases/checksumtypes_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'spec_helper'

describe 'Pulpcore::ChecksumTypes' do
it { is_expected.to allow_value(['sha1']) }
it { is_expected.to allow_value(['sha256']) }
it { is_expected.not_to allow_values(['sha0', 'md3']) }
it { is_expected.not_to allow_values([]) }
end
1 change: 1 addition & 0 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ REST_FRAMEWORK__DEFAULT_AUTHENTICATION_CLASSES = (

ALLOWED_IMPORT_PATHS = <%= scope['pulpcore::allowed_import_path'] %>
ALLOWED_EXPORT_PATHS = <%= scope['pulpcore::allowed_export_path'] %>
ALLOWED_CONTENT_CHECKSUMS = <%= scope['pulpcore::allowed_content_checksums'] %>

# Derive HTTP/HTTPS via the X-Forwarded-Proto header set by Apache
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
2 changes: 2 additions & 0 deletions types/checksumtypes.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The supported checksum types by pulpcore
type Pulpcore::ChecksumTypes = Array[Enum['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'], 1]