@@ -37,9 +37,11 @@ task :modules => "#{BUILDDIR}/modules"
3737if BUILD_KATELLO
3838 SCENARIOS = [ 'foreman' , 'foreman-proxy-content' , 'katello' ] . freeze
3939 CERTS_SCENARIOS = [ 'foreman-proxy-certs' ] . freeze
40+ NEW_CERTS_SCENARIOS = [ 'foreman-certs' ] . freeze
4041else
4142 SCENARIOS = [ 'foreman' ] . freeze
4243 CERTS_SCENARIOS = [ ] . freeze
44+ NEW_CERTS_SCENARIOS = [ ] . freeze
4345end
4446
4547exporter_dirs = ENV [ 'PATH' ] . split ( ':' ) . push ( '/usr/bin' , ENV [ 'KAFO_EXPORTER' ] )
@@ -136,6 +138,33 @@ CERTS_SCENARIOS.each do |scenario|
136138 end
137139end
138140
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+
139168file "#{ BUILDDIR } /foreman-installer" => 'bin/foreman-installer' do |t |
140169 cp t . prerequisites [ 0 ] , t . name
141170 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
146175 sh format ( 'sed -i "s#^.*\(CONFIG_DIR = \).*#\1%s#" %s' , "'#{ DATADIR } /foreman-installer/katello-certs/scenarios.d/'" , t . name )
147176end
148177
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+
149183file "#{ BUILDDIR } /katello-certs-check" => 'bin/katello-certs-check' do |t |
150184 cp t . prerequisites [ 0 ] , t . name
151185end
@@ -211,6 +245,7 @@ namespace :build do
211245
212246 if BUILD_KATELLO
213247 task :base => [
248+ "#{ BUILDDIR } /foreman-certs" ,
214249 "#{ BUILDDIR } /foreman-proxy-certs-generate" ,
215250 "#{ BUILDDIR } /katello-certs-check" ,
216251 ]
@@ -234,9 +269,16 @@ namespace :build do
234269 "#{ BUILDDIR } /parser_cache/#{ scenario } .yaml" ,
235270 ]
236271 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
237279end
238280
239- task :build => [ 'build:base' , 'build:scenarios' , 'build:certs_scenarios' ]
281+ task :build => [ 'build:base' , 'build:scenarios' , 'build:certs_scenarios' , 'build:new_certs_scenarios' ]
240282
241283task :install => :build do
242284 mkdir_p "#{ DATADIR } /foreman-installer"
@@ -261,6 +303,14 @@ task :install => :build do
261303 cp "katello_certs/config/#{ scenario } -answers.yaml" , "#{ DATADIR } /foreman-installer/katello-certs/scenarios.d/#{ scenario } -answers.yaml"
262304 end
263305
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+
264314 cp_r "#{ BUILDDIR } /modules" , "#{ DATADIR } /foreman-installer" , :preserve => true
265315 cp_r "#{ BUILDDIR } /parser_cache" , "#{ DATADIR } /foreman-installer"
266316
@@ -271,6 +321,7 @@ task :install => :build do
271321 install "#{ BUILDDIR } /foreman-installer" , "#{ SBINDIR } /foreman-installer" , :mode => 0o755 , :verbose => true
272322
273323 if BUILD_KATELLO
324+ install "#{ BUILDDIR } /foreman-certs" , "#{ SBINDIR } /foreman-certs" , :mode => 0o755 , :verbose => true
274325 install "#{ BUILDDIR } /foreman-proxy-certs-generate" , "#{ SBINDIR } /foreman-proxy-certs-generate" , :mode => 0o755 , :verbose => true
275326 install "#{ BUILDDIR } /katello-certs-check" , "#{ SBINDIR } /katello-certs-check" , :mode => 0o755 , :verbose => true
276327 end
0 commit comments