Skip to content

Commit

Permalink
support /pulp/deb proxying
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsherrill committed Nov 5, 2020
1 parent bb0b65a commit d83ae91
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
30 changes: 29 additions & 1 deletion manifests/plugin/deb.pp
Original file line number Diff line number Diff line change
@@ -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,
}
}
13 changes: 13 additions & 0 deletions spec/classes/plugin_deb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand All @@ -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
Expand Down

0 comments on commit d83ae91

Please sign in to comment.