diff --git a/manifests/plugin/pulp.pp b/manifests/plugin/pulp.pp index fcede88fb..8425ef221 100644 --- a/manifests/plugin/pulp.pp +++ b/manifests/plugin/pulp.pp @@ -4,21 +4,11 @@ # # === Advanced parameters: # -# $enabled:: enables/disables the pulp plugin -# # $listen_on:: proxy feature listens on http, https, or both # # $version:: plugin package version, it's passed to ensure parameter of package resource # can be set to specific version number, 'latest', 'present' etc. # -# $pulp_url:: pulp url to use -# -# $pulp_dir:: directory for pulp -# -# $pulp_content_dir:: directory for pulp content -# -# $pulpnode_enabled:: enables/disables the pulpnode plugin -# # $pulpcore_enabled:: enables/disables the pulpcore plugin # # $pulpcore_mirror:: Whether this pulpcore plugin acts as a mirror or another pulp node. A pulpcore mirror is the pulpcore equivalent of a pulpnode. @@ -27,43 +17,19 @@ # # $pulpcore_content_url:: The URL to the Pulp 3 content # -# $puppet_content_dir:: Directory for puppet content. Automatically determined if empty. -# -# $mongodb_dir:: directory for Mongo DB -# class foreman_proxy::plugin::pulp ( - Boolean $enabled = $foreman_proxy::plugin::pulp::params::enabled, - Foreman_proxy::ListenOn $listen_on = $foreman_proxy::plugin::pulp::params::listen_on, - Boolean $pulpnode_enabled = $foreman_proxy::plugin::pulp::params::pulpnode_enabled, - Boolean $pulpcore_enabled = $foreman_proxy::plugin::pulp::params::pulpcore_enabled, + Foreman_proxy::ListenOn $listen_on = 'https', + Boolean $pulpcore_enabled = true, + Boolean $pulpcore_mirror = false, Stdlib::HTTPUrl $pulpcore_api_url = $foreman_proxy::plugin::pulp::params::pulpcore_api_url, Stdlib::HTTPUrl $pulpcore_content_url = $foreman_proxy::plugin::pulp::params::pulpcore_content_url, - Boolean $pulpcore_mirror = $foreman_proxy::plugin::pulp::params::pulpcore_mirror, - Optional[String] $version = $foreman_proxy::plugin::pulp::params::version, - Stdlib::HTTPUrl $pulp_url = $foreman_proxy::plugin::pulp::params::pulp_url, - Stdlib::Absolutepath $pulp_dir = $foreman_proxy::plugin::pulp::params::pulp_dir, - Stdlib::Absolutepath $pulp_content_dir = $foreman_proxy::plugin::pulp::params::pulp_content_dir, - Optional[Stdlib::Absolutepath] $puppet_content_dir = $foreman_proxy::plugin::pulp::params::puppet_content_dir, - Stdlib::Absolutepath $mongodb_dir = $foreman_proxy::plugin::pulp::params::mongodb_dir, + Optional[String] $version = undef, ) inherits foreman_proxy::plugin::pulp::params { - $real_puppet_content_dir = pick($puppet_content_dir, lookup('puppet::server_envs_dir') |$key| { undef }, $facts['puppet_environmentpath'], "${foreman_proxy::puppetcodedir}/environments") foreman_proxy::plugin {'pulp': version => $version, } -> [ - foreman_proxy::module { 'pulp': - template_path => 'foreman_proxy/plugin/pulp.yml.erb', - enabled => $enabled, - feature => 'Pulp', - listen_on => $listen_on, - }, - foreman_proxy::module { 'pulpnode': - template_path => 'foreman_proxy/plugin/pulpnode.yml.erb', - enabled => $pulpnode_enabled, - feature => 'Pulp Node', - listen_on => $listen_on, - }, foreman_proxy::module { 'pulpcore': template_path => 'foreman_proxy/plugin/pulpcore.yml.erb', enabled => $pulpcore_enabled, @@ -73,5 +39,11 @@ foreman_proxy::settings_file { 'pulp3': # file removed in rubygem-smart_proxy_pulp 2.0 ensure => absent, }, + foreman_proxy::settings_file { 'pulp': # Pulp 2 support dropped in Katello 4.0 + ensure => absent, + }, + foreman_proxy::settings_file { 'pulpnode': # Pulp 2 support dropped in Katello 4.0 + ensure => absent, + }, ] } diff --git a/manifests/plugin/pulp/params.pp b/manifests/plugin/pulp/params.pp index 34804dfb0..81438d940 100644 --- a/manifests/plugin/pulp/params.pp +++ b/manifests/plugin/pulp/params.pp @@ -1,17 +1,6 @@ # Default parameters for the Pulp smart proxy plugin # @api private class foreman_proxy::plugin::pulp::params { - $enabled = true - $listen_on = 'https' - $version = undef - $pulpnode_enabled = false - $pulpcore_enabled = false - $pulpcore_mirror = false - $pulp_url = "https://${facts['networking']['fqdn']}/pulp" $pulpcore_api_url = "https://${facts['networking']['fqdn']}" - $pulpcore_content_url = "${pulp_url}/content" - $pulp_dir = '/var/lib/pulp' - $pulp_content_dir = '/var/lib/pulp/content' - $puppet_content_dir = undef - $mongodb_dir = '/var/lib/mongodb' + $pulpcore_content_url = "${pulpcore_api_url}/pulp/content" } diff --git a/spec/classes/foreman_proxy__plugin__pulp_spec.rb b/spec/classes/foreman_proxy__plugin__pulp_spec.rb index a99ef52f9..21fa7167b 100644 --- a/spec/classes/foreman_proxy__plugin__pulp_spec.rb +++ b/spec/classes/foreman_proxy__plugin__pulp_spec.rb @@ -11,39 +11,15 @@ it { is_expected.to compile.with_all_deps } it { is_expected.to contain_foreman_proxy__plugin('pulp') } - it 'should configure pulp.yml' do + it 'should configure pulpnode.yml' do is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp.yml") - .with_ensure('file') - .with_owner('root') - .with_group('foreman-proxy') - - verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp.yml", [ - '---', - ':enabled: https', - ":pulp_url: https://#{facts[:fqdn]}/pulp", - ':pulp_dir: /var/lib/pulp', - ':pulp_content_dir: /var/lib/pulp/content', - ':puppet_content_dir: /etc/puppetlabs/code/environments', - ':mongodb_dir: /var/lib/mongodb' - ]) - end + .with_ensure('absent') + end it 'should configure pulpnode.yml' do is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulpnode.yml") - .with_ensure('file') - .with_owner('root') - .with_group('foreman-proxy') - - verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpnode.yml", [ - '---', - ':enabled: false', - ":pulp_url: https://#{facts[:fqdn]}/pulp", - ':pulp_dir: /var/lib/pulp', - ':pulp_content_dir: /var/lib/pulp/content', - ':puppet_content_dir: /etc/puppetlabs/code/environments', - ':mongodb_dir: /var/lib/mongodb' - ]) - end + .with_ensure('absent') + end it 'should configure pulpcore.yml' do is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml") @@ -53,7 +29,7 @@ verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml", [ '---', - ':enabled: false', + ':enabled: https', ":pulp_url: https://#{facts[:fqdn]}", ":content_app_url: https://#{facts[:fqdn]}/pulp/content", ':mirror: false' @@ -63,52 +39,22 @@ it 'should remove pulp3.yml' do is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp3.yml") .with_ensure('absent') - end + end end describe 'with overrides' do let :params do { - pulpnode_enabled: true, pulpcore_enabled: true, pulpcore_mirror: true, pulpcore_api_url: 'https://pulpcore.example.com', - pulpcore_content_url: 'https://pulpcore.example.com/pulp/content', - pulp_url: 'https://pulp.example.com', - pulp_dir: '/tmp/pulp', - pulp_content_dir: '/tmp/content', - puppet_content_dir: '/tmp/puppet', - mongodb_dir: '/tmp/mongodb', + pulpcore_content_url: 'https://pulpcore.example.com/pulp/content' } end it { is_expected.to compile.with_all_deps } it { is_expected.to contain_foreman_proxy__plugin('pulp') } - it 'should configure pulp.yml' do - verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp.yml", [ - '---', - ':enabled: https', - ':pulp_url: https://pulp.example.com', - ':pulp_dir: /tmp/pulp', - ':pulp_content_dir: /tmp/content', - ':puppet_content_dir: /tmp/puppet', - ':mongodb_dir: /tmp/mongodb' - ]) - end - - it 'should configure pulpnode.yml' do - verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpnode.yml", [ - '---', - ':enabled: https', - ':pulp_url: https://pulp.example.com', - ':pulp_dir: /tmp/pulp', - ':pulp_content_dir: /tmp/content', - ':puppet_content_dir: /tmp/puppet', - ':mongodb_dir: /tmp/mongodb' - ]) - end - it 'should configure pulpcore.yml' do verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml", [ '---', diff --git a/templates/plugin/pulp.yml.erb b/templates/plugin/pulp.yml.erb index c0642a911..5f801016f 100644 --- a/templates/plugin/pulp.yml.erb +++ b/templates/plugin/pulp.yml.erb @@ -1,9 +1,3 @@ --- # Pulp integration :enabled: <%= @module_enabled %> -:pulp_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_url") %> -# Path to pulp, pulp content and mongodb directories -:pulp_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_dir") %> -:pulp_content_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_content_dir") %> -:puppet_content_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::real_puppet_content_dir") %> -:mongodb_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::mongodb_dir") %> diff --git a/templates/plugin/pulpnode.yml.erb b/templates/plugin/pulpnode.yml.erb index c0642a911..5f801016f 100644 --- a/templates/plugin/pulpnode.yml.erb +++ b/templates/plugin/pulpnode.yml.erb @@ -1,9 +1,3 @@ --- # Pulp integration :enabled: <%= @module_enabled %> -:pulp_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_url") %> -# Path to pulp, pulp content and mongodb directories -:pulp_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_dir") %> -:pulp_content_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp_content_dir") %> -:puppet_content_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::real_puppet_content_dir") %> -:mongodb_dir: <%= scope.lookupvar("foreman_proxy::plugin::pulp::mongodb_dir") %>