Class: Foreman::Export::Initd

Inherits:
Base
  • Object
show all
Includes:
Initd::Export
Defined in:
lib/foreman/export/initd.rb

Instance Method Summary collapse

Instance Method Details

#exportObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/foreman/export/initd.rb', line 6

def export
  error('Must specify a location') unless location
  setup

  engine.each_process do |name, process|
    args = Shellwords.split(process.command)
    script = Pathname.new(engine.root).join(args.shift)
    path = path(name)
    concurrency = concurrency(name)
    if concurrency > 0
      say 'Warning: Initd exporter ignores concurrency > 1' if concurrency > 1
      contents = Initd::Script.new(path, script, args, user).content
      export_file path, contents
    end
  end
  cleanup
end