diff --git a/manifests/plugin/deb.pp b/manifests/plugin/deb.pp index b291f517..224671b9 100644 --- a/manifests/plugin/deb.pp +++ b/manifests/plugin/deb.pp @@ -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, } } diff --git a/spec/classes/plugin_deb_spec.rb b/spec/classes/plugin_deb_spec.rb index d72bf68b..bc0eb3d3 100644 --- a/spec/classes/plugin_deb_spec.rb +++ b/spec/classes/plugin_deb_spec.rb @@ -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' } @@ -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