From eb3ad130eb0689a9720b9c2beefff767ef1e5863 Mon Sep 17 00:00:00 2001 From: William Clark Date: Mon, 6 Jan 2020 14:26:38 -0500 Subject: [PATCH] use pulpcore naming convention solves https://github.com/theforeman/puppet-foreman_proxy/issues/550 --- manifests/plugin/pulp.pp | 57 ++++++++++--------- manifests/plugin/pulp/params.pp | 28 ++++----- .../foreman_proxy__plugin__pulp_spec.rb | 29 ++++++---- .../{pulp3.yml.erb => pulpcore.yml.erb} | 6 +- 4 files changed, 65 insertions(+), 55 deletions(-) rename templates/plugin/{pulp3.yml.erb => pulpcore.yml.erb} (56%) diff --git a/manifests/plugin/pulp.pp b/manifests/plugin/pulp.pp index 78d6cd73..0c08d86b 100644 --- a/manifests/plugin/pulp.pp +++ b/manifests/plugin/pulp.pp @@ -21,13 +21,13 @@ # # $pulpnode_enabled:: enables/disables the pulpnode plugin # -# $pulp3_enabled:: enables/disables the pulp3 plugin +# $pulpcore_enabled:: enables/disables the pulpcore plugin # -# $pulp3_mirror:: Whether this pulp3 plugin acts as a mirror or another pulp node. A pulp3 mirror is the pulp3 equivalent of a pulpnode. +# $pulpcore_mirror:: Whether this pulpcore plugin acts as a mirror or another pulp node. A pulpcore mirror is the pulpcore equivalent of a pulpnode. # -# $pulp3_api_url:: The URL to the Pulp 3 API +# $pulpcore_api_url:: The URL to the Pulp 3 API # -# $pulp3_content_url:: The URL to the Pulp 3 content +# $pulpcore_content_url:: The URL to the Pulp 3 content # # $puppet_content_dir:: directory for puppet content # @@ -37,10 +37,10 @@ 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 $pulp3_enabled = $::foreman_proxy::plugin::pulp::params::pulp3_enabled, - Stdlib::HTTPUrl $pulp3_api_url = $::foreman_proxy::plugin::pulp::params::pulp3_api_url, - Stdlib::HTTPUrl $pulp3_content_url = $::foreman_proxy::plugin::pulp::params::pulp3_content_url, - Boolean $pulp3_mirror = $::foreman_proxy::plugin::pulp::params::pulp3_mirror, + Boolean $pulpcore_enabled = $::foreman_proxy::plugin::pulp::params::pulpcore_enabled, + 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, Optional[String] $group = $::foreman_proxy::plugin::pulp::params::group, Stdlib::HTTPUrl $pulp_url = $::foreman_proxy::plugin::pulp::params::pulp_url, @@ -52,22 +52,27 @@ foreman_proxy::plugin {'pulp': version => $version, } - -> foreman_proxy::settings_file { 'pulp': - template_path => 'foreman_proxy/plugin/pulp.yml.erb', - group => $group, - enabled => $enabled, - listen_on => $listen_on, - } - -> foreman_proxy::settings_file { 'pulpnode': - template_path => 'foreman_proxy/plugin/pulpnode.yml.erb', - group => $group, - enabled => $pulpnode_enabled, - listen_on => $listen_on, - } - -> foreman_proxy::settings_file { 'pulp3': - template_path => 'foreman_proxy/plugin/pulp3.yml.erb', - group => $group, - enabled => $pulp3_enabled, - listen_on => $listen_on, - } + -> [ + foreman_proxy::settings_file { 'pulp': + template_path => 'foreman_proxy/plugin/pulp.yml.erb', + group => $group, + enabled => $enabled, + listen_on => $listen_on, + }, + foreman_proxy::settings_file { 'pulpnode': + template_path => 'foreman_proxy/plugin/pulpnode.yml.erb', + group => $group, + enabled => $pulpnode_enabled, + listen_on => $listen_on, + }, + foreman_proxy::settings_file { 'pulpcore': + template_path => 'foreman_proxy/plugin/pulpcore.yml.erb', + group => $group, + enabled => $pulpcore_enabled, + listen_on => $listen_on, + }, + foreman_proxy::settings_file { 'pulp3': # file removed in rubygem-smart_proxy_pulp 2.0 + ensure => absent, + }, + ] } diff --git a/manifests/plugin/pulp/params.pp b/manifests/plugin/pulp/params.pp index b6eac8ce..39a8d9ce 100644 --- a/manifests/plugin/pulp/params.pp +++ b/manifests/plugin/pulp/params.pp @@ -3,18 +3,18 @@ class foreman_proxy::plugin::pulp::params { include ::foreman_proxy::params - $enabled = true - $listen_on = 'https' - $version = undef - $group = undef - $pulpnode_enabled = false - $pulp3_enabled = false - $pulp3_mirror = false - $pulp_url = "https://${::fqdn}/pulp" - $pulp3_api_url = "https://${::fqdn}" - $pulp3_content_url = "${pulp_url}/content" - $pulp_dir = '/var/lib/pulp' - $pulp_content_dir = '/var/lib/pulp/content' - $puppet_content_dir = pick($::puppet_environmentpath, "${::foreman_proxy::params::puppetdir}/environments") - $mongodb_dir = '/var/lib/mongodb' + $enabled = true + $listen_on = 'https' + $version = undef + $group = undef + $pulpnode_enabled = false + $pulpcore_enabled = false + $pulpcore_mirror = false + $pulp_url = "https://${::fqdn}/pulp" + $pulpcore_api_url = "https://${::fqdn}" + $pulpcore_content_url = "${pulp_url}/content" + $pulp_dir = '/var/lib/pulp' + $pulp_content_dir = '/var/lib/pulp/content' + $puppet_content_dir = pick($::puppet_environmentpath, "${::foreman_proxy::params::puppetdir}/environments") + $mongodb_dir = '/var/lib/mongodb' } diff --git a/spec/classes/foreman_proxy__plugin__pulp_spec.rb b/spec/classes/foreman_proxy__plugin__pulp_spec.rb index 8809e784..a5698aaa 100644 --- a/spec/classes/foreman_proxy__plugin__pulp_spec.rb +++ b/spec/classes/foreman_proxy__plugin__pulp_spec.rb @@ -45,13 +45,13 @@ ]) end - it 'should configure pulp3.yml' do - is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp3.yml") + it 'should configure pulpcore.yml' do + is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml") .with_ensure('file') .with_owner('root') .with_group('foreman-proxy') - verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp3.yml", [ + verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml", [ '---', ':enabled: false', ":pulp_url: https://#{facts[:fqdn]}", @@ -59,6 +59,11 @@ ':mirror: false' ]) end + + it 'should remove pulp3.yml' do + is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp3.yml") + .with_ensure('absent') + end end describe 'with overrides' do @@ -66,10 +71,10 @@ { group: 'example', pulpnode_enabled: true, - pulp3_enabled: true, - pulp3_mirror: true, - pulp3_api_url: 'https://pulp3.example.com', - pulp3_content_url: 'https://pulp3.example.com/pulp/content', + 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', @@ -114,17 +119,17 @@ ]) end - it 'should configure pulp3.yml' do - is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulp3.yml") + it 'should configure pulpcore.yml' do + is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml") .with_ensure('file') .with_owner('root') .with_group('example') - verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulp3.yml", [ + verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/pulpcore.yml", [ '---', ':enabled: https', - ':pulp_url: https://pulp3.example.com', - ":content_app_url: https://pulp3.example.com/pulp/content", + ':pulp_url: https://pulpcore.example.com', + ":content_app_url: https://pulpcore.example.com/pulp/content", ':mirror: true' ]) end diff --git a/templates/plugin/pulp3.yml.erb b/templates/plugin/pulpcore.yml.erb similarity index 56% rename from templates/plugin/pulp3.yml.erb rename to templates/plugin/pulpcore.yml.erb index 455173d0..4ff06cc0 100644 --- a/templates/plugin/pulp3.yml.erb +++ b/templates/plugin/pulpcore.yml.erb @@ -1,5 +1,5 @@ --- :enabled: <%= @module_enabled %> -:pulp_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp3_api_url") %> -:content_app_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp3_content_url") %> -:mirror: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulp3_mirror") %> +:pulp_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulpcore_api_url") %> +:content_app_url: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulpcore_content_url") %> +:mirror: <%= scope.lookupvar("foreman_proxy::plugin::pulp::pulpcore_mirror") %>