Class: Foreman::Export::Systemd
- Defined in:
- lib/foreman/export/systemd.rb
Instance Attribute Summary
Attributes inherited from Base
#engine, #formation, #location, #options, #port
Instance Method Summary collapse
Methods inherited from Base
#app, #initialize, #log, procfile, #run, #template, #user
Constructor Details
This class inherits a constructor from Foreman::Export::Base
Instance Method Details
#export ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/foreman/export/systemd.rb', line 6 def export super Dir["#{location}/#{app}*.target"] .concat(Dir["#{location}/#{app}*.service"]) .concat(Dir["#{location}/#{app}*.target.wants/#{app}*.service"]) .each do |file| clean file end Dir["#{location}/#{app}*.target.wants"].each do |file| clean_dir file end service_names = [] engine.each_process do |name, process| 1.upto(engine.formation[name]) do |num| port = engine.port_for(process, num) process_name = "#{name}.#{num}" service_filename = "#{app}-#{process_name}.service" write_template "systemd/process.service.erb", service_filename, binding service_names << service_filename end end write_template "systemd/master.target.erb", "#{app}.target", binding end |