Sha256: bdcf10d3aff0e9ed4b94283b5d14dcd19ca21f92e3339fcb119227f70624a967

Contents?: true

Size: 1006 Bytes

Versions: 9

Compression:

Stored size: 1006 Bytes

Contents

require "erb"
require "foreman/export"

class Foreman::Export::Upstart < Foreman::Export::Base

  def export
    super

    master_file = "#{app}.conf"

    clean File.join(location, master_file)
    write_template master_template, master_file, binding

    engine.each_process do |name, process|
      process_master_file = "#{app}-#{name}.conf"
      clean File.join(location, process_master_file)

      next if engine.formation[name] < 1
      write_template process_master_template, process_master_file, binding

      1.upto(engine.formation[name]) do |num|
        port = engine.port_for(process, num)
        process_file = "#{app}-#{name}-#{num}.conf"
        clean File.join(location, process_file)
        write_template process_template, process_file, binding
      end
    end
  end

  private

  def master_template
    "upstart/master.conf.erb"
  end

  def process_master_template
    "upstart/process_master.conf.erb"
  end

  def process_template
    "upstart/process.conf.erb"
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
ypadlyak-foreman-0.81.0 lib/foreman/export/upstart.rb
foreman-systemd-0.78.0 lib/foreman/export/upstart.rb
foreman-0.82.0 lib/foreman/export/upstart.rb
foreman-0.81.0 lib/foreman/export/upstart.rb
foreman-0.80.2 lib/foreman/export/upstart.rb
foreman-0.80.1 lib/foreman/export/upstart.rb
foreman-0.80.0 lib/foreman/export/upstart.rb
foreman-0.78.0 lib/foreman/export/upstart.rb
foreman-0.77.0 lib/foreman/export/upstart.rb