Skip to content

Commit 7d50ca0

Browse files
committed
Refs #31614: Wrap foreman_proxy::plugin::pulp and configure it
1 parent 854498b commit 7d50ca0

File tree

4 files changed

+43
-107
lines changed

4 files changed

+43
-107
lines changed

manifests/init.pp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#
1313
# $enable_deb:: Enable debian content plugin
1414
#
15+
# $pulpcore_mirror:: Deploy Pulp to be used as a mirror
16+
#
1517
# === Advanced parameters:
1618
#
1719
# $puppet:: Enable puppet
@@ -78,6 +80,8 @@
7880
# incrementally with benchmarking at each step to determine an optimal value for your deployment.
7981
#
8082
class foreman_proxy_content (
83+
Boolean $pulpcore_mirror = false,
84+
8185
Boolean $puppet = true,
8286

8387
Boolean $reverse_proxy = false,
@@ -119,17 +123,13 @@
119123
) inherits foreman_proxy_content::params {
120124
include certs
121125
include foreman_proxy
122-
include foreman_proxy::plugin::pulp
123-
124-
$pulpcore_mirror = $foreman_proxy::plugin::pulp::pulpcore_mirror
125-
$pulpcore = $foreman_proxy::plugin::pulp::pulpcore_enabled
126126

127127
$foreman_url = $foreman_proxy::foreman_base_url
128128
$foreman_host = foreman_proxy_content::host_from_url($foreman_url)
129129
$reverse_proxy_real = $pulpcore_mirror or $reverse_proxy
130130

131131
# TODO: doesn't allow deploying a Pulp non-mirror without Foreman
132-
$shared_with_foreman_vhost = $pulpcore and !$pulpcore_mirror
132+
$shared_with_foreman_vhost = !$pulpcore_mirror
133133

134134
$rhsm_port = $reverse_proxy_real ? {
135135
true => $reverse_proxy_port,
@@ -272,6 +272,16 @@
272272
}
273273
include pulpcore::plugin::certguard # Required to be present by Katello when syncing a content proxy
274274

275+
class { 'foreman_proxy::plugin::pulp':
276+
enabled => false,
277+
pulpnode_enabled => false,
278+
pulpcore_enabled => true,
279+
pulpcore_mirror => $pulpcore_mirror,
280+
pulpcore_api_url => "https://${servername}${pulpcore::apache::api_path}",
281+
pulpcore_content_url => "https://${servername}${pulpcore::apache::content_path}",
282+
require => Class['pulpcore'],
283+
}
284+
275285
if $puppet {
276286
# We can't pull the certs out to the top level, because of how it gets the default
277287
# parameter values from the main certs class. Kafo can't handle that case, so

spec/classes/foreman_proxy_content__pub_dir_spec.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@
77
facts
88
end
99

10-
let(:pre_condition) do
11-
<<-PUPPET
12-
include foreman_proxy
13-
class { 'foreman_proxy::plugin::pulp':
14-
enabled => false,
15-
pulpnode_enabled => false,
16-
pulpcore_enabled => false,
17-
}
18-
PUPPET
19-
end
20-
2110
it { should compile.with_all_deps }
2211
it { should contain_package('katello-client-bootstrap') }
2312
end

spec/classes/foreman_proxy_content__reverse_proxy_spec.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99

1010
let(:pre_condition) do
1111
<<-PUPPET
12-
include foreman_proxy
13-
class { 'foreman_proxy::plugin::pulp':
14-
enabled => false,
15-
pulpnode_enabled => false,
16-
pulpcore_enabled => false,
17-
}
1812
include foreman_proxy_content
1913
PUPPET
2014
end
@@ -37,17 +31,6 @@ class { 'foreman_proxy::plugin::pulp':
3731
describe 'with explicit parameters' do
3832
let(:params) { { url: 'https://foreman.example.com/', port: 443 } }
3933

40-
let(:pre_condition) do
41-
<<-PUPPET
42-
include foreman_proxy
43-
class { 'foreman_proxy::plugin::pulp':
44-
enabled => false,
45-
pulpnode_enabled => false,
46-
pulpcore_enabled => false,
47-
}
48-
PUPPET
49-
end
50-
5134
it { is_expected.to compile.with_all_deps }
5235
it do
5336
is_expected.to contain_apache__vhost('katello-reverse-proxy')

spec/classes/foreman_proxy_content_spec.rb

Lines changed: 28 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@
66
let(:facts) { facts }
77

88
context 'without parameters' do
9-
let(:pre_condition) do
10-
<<-PUPPET
11-
include foreman_proxy
12-
class { 'foreman_proxy::plugin::pulp':
13-
enabled => false,
14-
pulpnode_enabled => false,
15-
pulpcore_enabled => false,
16-
}
17-
PUPPET
18-
end
19-
209
it { is_expected.to compile.with_all_deps }
2110
it { is_expected.to contain_package('katello-debug') }
2211
it { is_expected.to contain_class('foreman_proxy_content::pub_dir') }
@@ -29,18 +18,6 @@ class { 'foreman_proxy::plugin::pulp':
2918
}
3019
end
3120

32-
let(:pre_condition) do
33-
<<-PUPPET
34-
include foreman_proxy
35-
class { 'foreman_proxy::plugin::pulp':
36-
enabled => false,
37-
pulpnode_enabled => false,
38-
pulpcore_enabled => true,
39-
pulpcore_mirror => false,
40-
}
41-
PUPPET
42-
end
43-
4421
it { is_expected.to compile.with_all_deps }
4522
it { is_expected.to contain_class('foreman_proxy_content::pub_dir') }
4623
it do
@@ -50,38 +27,6 @@ class { 'foreman_proxy::plugin::pulp':
5027
.that_comes_before('Class[foreman_proxy::plugin::pulp]')
5128
end
5229

53-
context 'as mirror' do
54-
let(:pre_condition) do
55-
<<-PUPPET
56-
include foreman_proxy
57-
class { 'foreman_proxy::plugin::pulp':
58-
enabled => false,
59-
pulpnode_enabled => false,
60-
pulpcore_enabled => true,
61-
pulpcore_mirror => true,
62-
}
63-
PUPPET
64-
end
65-
66-
it { is_expected.to compile.with_all_deps }
67-
it { is_expected.to contain_class('foreman_proxy_content::pub_dir') }
68-
it do
69-
is_expected.to contain_class('pulpcore')
70-
.with(apache_http_vhost: true)
71-
.with(apache_https_vhost: true)
72-
.that_comes_before('Class[foreman_proxy::plugin::pulp]')
73-
end
74-
it do
75-
is_expected.to contain_class('foreman_proxy_content::reverse_proxy')
76-
.with(path: '/')
77-
.with(port: 8443)
78-
end
79-
it do
80-
is_expected.to contain_pulpcore__apache__fragment('gpg_key_proxy')
81-
.with_https_content(%r{ProxyPass /katello/api/v2/repositories/ https://foo\.example\.com/katello/api/v2/repositories/})
82-
end
83-
end
84-
8530
context 'with external postgres' do
8631
let(:params) do
8732
super().merge(
@@ -133,6 +78,34 @@ class { 'foreman_proxy::plugin::pulp':
13378
end
13479
end
13580

81+
context 'as mirror' do
82+
let(:pre_condition) do
83+
<<-PUPPET
84+
class { 'foreman_proxy_content':
85+
pulpcore_mirror => true,
86+
}
87+
PUPPET
88+
end
89+
90+
it { is_expected.to compile.with_all_deps }
91+
it { is_expected.to contain_class('foreman_proxy_content::pub_dir') }
92+
it do
93+
is_expected.to contain_class('pulpcore')
94+
.with(apache_http_vhost: true)
95+
.with(apache_https_vhost: true)
96+
.that_comes_before('Class[foreman_proxy::plugin::pulp]')
97+
end
98+
it do
99+
is_expected.to contain_class('foreman_proxy_content::reverse_proxy')
100+
.with(path: '/')
101+
.with(port: 8443)
102+
end
103+
it do
104+
is_expected.to contain_pulpcore__apache__fragment('gpg_key_proxy')
105+
.with_https_content(%r{ProxyPass /katello/api/v2/repositories/ https://foo\.example\.com/katello/api/v2/repositories/})
106+
end
107+
end
108+
136109
context 'with puppet' do
137110
let(:params) do
138111
{
@@ -147,13 +120,6 @@ class { 'puppet':
147120
server => true,
148121
server_foreman => true,
149122
}
150-
include foreman_proxy
151-
class { 'foreman_proxy::plugin::pulp':
152-
enabled => false,
153-
pulpnode_enabled => false,
154-
pulpcore_enabled => false,
155-
pulpcore_mirror => false,
156-
}
157123
PUPPET
158124
end
159125

@@ -165,18 +131,6 @@ class { 'foreman_proxy::plugin::pulp':
165131
end
166132

167133
describe 'with puppet server disabled' do
168-
let(:pre_condition) do
169-
<<-PUPPET
170-
include foreman_proxy
171-
class { 'foreman_proxy::plugin::pulp':
172-
enabled => false,
173-
pulpnode_enabled => false,
174-
pulpcore_enabled => false,
175-
pulpcore_mirror => false,
176-
}
177-
PUPPET
178-
end
179-
180134
it { is_expected.to compile.with_all_deps }
181135
it { is_expected.not_to contain_class('certs::puppet') }
182136
end

0 commit comments

Comments
 (0)