Skip to content

Commit

Permalink
clean all upstart process files
Browse files Browse the repository at this point in the history
instead of cleaning only for the number of processes defined in the
formation, we now remove all files using a glob.

intentionally not moving the glob higher up, because that has a higher
risk of matching files that do not belong to the application.

fixes ddollar#646
  • Loading branch information
koenpunt committed Oct 25, 2016
1 parent eab2e9c commit ff5e0fb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/foreman/export/upstart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ def export

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

Dir[
File.join(location, process_master_file),
File.join(location, "#{app}-#{name}-*.conf")
].each { |f| clean(f) }

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
Expand Down

0 comments on commit ff5e0fb

Please sign in to comment.