@@ -37,9 +37,11 @@ task :modules => "#{BUILDDIR}/modules"
37
37
if BUILD_KATELLO
38
38
SCENARIOS = [ 'foreman' , 'foreman-proxy-content' , 'katello' ] . freeze
39
39
CERTS_SCENARIOS = [ 'foreman-proxy-certs' ] . freeze
40
+ NEW_CERTS_SCENARIOS = [ 'foreman-certs' ] . freeze
40
41
else
41
42
SCENARIOS = [ 'foreman' ] . freeze
42
43
CERTS_SCENARIOS = [ ] . freeze
44
+ NEW_CERTS_SCENARIOS = [ ] . freeze
43
45
end
44
46
45
47
exporter_dirs = ENV [ 'PATH' ] . split ( ':' ) . push ( '/usr/bin' , ENV [ 'KAFO_EXPORTER' ] )
@@ -136,6 +138,33 @@ CERTS_SCENARIOS.each do |scenario|
136
138
end
137
139
end
138
140
141
+ NEW_CERTS_SCENARIOS . each do |scenario |
142
+ config = "foreman_certs/config/#{ scenario } .yaml"
143
+ file "#{ BUILDDIR } /#{ scenario } .yaml" => [ config , BUILDDIR ] do |t |
144
+ cp t . prerequisites . first , t . name
145
+
146
+ scenario_config_replacements = {
147
+ 'answer_file' => "#{ DATADIR } /foreman-installer/foreman-certs/scenarios.d/#{ scenario } -answers.yaml" ,
148
+ 'installer_dir' => "#{ DATADIR } /foreman-installer/foreman-certs" ,
149
+ 'log_dir' => "#{ LOGDIR } /foreman-installer" ,
150
+ 'module_dirs' => "#{ DATADIR } /foreman-installer/modules" ,
151
+ 'parser_cache_path' => "#{ DATADIR } /foreman-installer/parser_cache/#{ scenario } .yaml" ,
152
+ }
153
+
154
+ scenario_config_replacements . each do |setting , value |
155
+ sh format ( 'sed -i "s#\(.*%s:\).*#\1 %s#" %s' , setting , value , t . name )
156
+ end
157
+ end
158
+
159
+ file "#{ BUILDDIR } /parser_cache/#{ scenario } .yaml" => [ config , "#{ BUILDDIR } /modules" , "#{ BUILDDIR } /parser_cache" ] do |t |
160
+ sh "#{ exporter } /kafo-export-params -c #{ t . prerequisites . first } -f parsercache --no-parser-cache -o #{ t . name } "
161
+ end
162
+
163
+ file "#{ BUILDDIR } /#{ scenario } -options.asciidoc" => [ config , "#{ BUILDDIR } /parser_cache/#{ scenario } .yaml" ] do |t |
164
+ sh "#{ exporter } /kafo-export-params -c #{ t . prerequisites . first } -f asciidoc -o #{ t . name } "
165
+ end
166
+ end
167
+
139
168
file "#{ BUILDDIR } /foreman-installer" => 'bin/foreman-installer' do |t |
140
169
cp t . prerequisites [ 0 ] , t . name
141
170
sh format ( 'sed -i "s#\(^.*CONFIG_DIR = \).*#CONFIG_DIR = %s#" %s' , "'#{ SYSCONFDIR } /foreman-installer/scenarios.d/'" , t . name )
@@ -146,6 +175,11 @@ file "#{BUILDDIR}/foreman-proxy-certs-generate" => 'bin/foreman-proxy-certs-gene
146
175
sh format ( 'sed -i "s#^.*\(CONFIG_DIR = \).*#\1%s#" %s' , "'#{ DATADIR } /foreman-installer/katello-certs/scenarios.d/'" , t . name )
147
176
end
148
177
178
+ file "#{ BUILDDIR } /foreman-certs" => 'bin/foreman-certs' do |t |
179
+ cp t . prerequisites [ 0 ] , t . name
180
+ sh format ( 'sed -i "s#^.*\(CONFIG_DIR = \).*#\1%s#" %s' , "'#{ DATADIR } /foreman-installer/foreman-certs/scenarios.d/'" , t . name )
181
+ end
182
+
149
183
file "#{ BUILDDIR } /katello-certs-check" => 'bin/katello-certs-check' do |t |
150
184
cp t . prerequisites [ 0 ] , t . name
151
185
end
@@ -211,6 +245,7 @@ namespace :build do
211
245
212
246
if BUILD_KATELLO
213
247
task :base => [
248
+ "#{ BUILDDIR } /foreman-certs" ,
214
249
"#{ BUILDDIR } /foreman-proxy-certs-generate" ,
215
250
"#{ BUILDDIR } /katello-certs-check" ,
216
251
]
@@ -234,9 +269,16 @@ namespace :build do
234
269
"#{ BUILDDIR } /parser_cache/#{ scenario } .yaml" ,
235
270
]
236
271
end ] . flatten
272
+
273
+ task :new_certs_scenarios => [ NEW_CERTS_SCENARIOS . map do |scenario |
274
+ [
275
+ "#{ BUILDDIR } /#{ scenario } .yaml" ,
276
+ "#{ BUILDDIR } /parser_cache/#{ scenario } .yaml" ,
277
+ ]
278
+ end ] . flatten
237
279
end
238
280
239
- task :build => [ 'build:base' , 'build:scenarios' , 'build:certs_scenarios' ]
281
+ task :build => [ 'build:base' , 'build:scenarios' , 'build:certs_scenarios' , 'build:new_certs_scenarios' ]
240
282
241
283
task :install => :build do
242
284
mkdir_p "#{ DATADIR } /foreman-installer"
@@ -261,6 +303,14 @@ task :install => :build do
261
303
cp "katello_certs/config/#{ scenario } -answers.yaml" , "#{ DATADIR } /foreman-installer/katello-certs/scenarios.d/#{ scenario } -answers.yaml"
262
304
end
263
305
306
+ if NEW_CERTS_SCENARIOS . any?
307
+ mkdir_p "#{ DATADIR } /foreman-installer/foreman-certs/scenarios.d"
308
+ end
309
+ NEW_CERTS_SCENARIOS . each do |scenario |
310
+ cp "#{ BUILDDIR } /#{ scenario } .yaml" , "#{ DATADIR } /foreman-installer/foreman-certs/scenarios.d/#{ scenario } .yaml"
311
+ cp "foreman_certs/config/#{ scenario } -answers.yaml" , "#{ DATADIR } /foreman-installer/foreman-certs/scenarios.d/#{ scenario } -answers.yaml"
312
+ end
313
+
264
314
cp_r "#{ BUILDDIR } /modules" , "#{ DATADIR } /foreman-installer" , :preserve => true
265
315
cp_r "#{ BUILDDIR } /parser_cache" , "#{ DATADIR } /foreman-installer"
266
316
@@ -271,6 +321,7 @@ task :install => :build do
271
321
install "#{ BUILDDIR } /foreman-installer" , "#{ SBINDIR } /foreman-installer" , :mode => 0o755 , :verbose => true
272
322
273
323
if BUILD_KATELLO
324
+ install "#{ BUILDDIR } /foreman-certs" , "#{ SBINDIR } /foreman-certs" , :mode => 0o755 , :verbose => true
274
325
install "#{ BUILDDIR } /foreman-proxy-certs-generate" , "#{ SBINDIR } /foreman-proxy-certs-generate" , :mode => 0o755 , :verbose => true
275
326
install "#{ BUILDDIR } /katello-certs-check" , "#{ SBINDIR } /katello-certs-check" , :mode => 0o755 , :verbose => true
276
327
end
0 commit comments