Merge pull request #317 from andymorris/fix_deleted_upstart_files

Prevent upstart export from deleting similarly named upstart files
This commit is contained in:
David Dollar
2013-04-14 08:45:21 -07:00
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ class Foreman::Export::Upstart < Foreman::Export::Base
def export
super
Dir["#{location}/#{app}*.conf"].each do |file|
(Dir["#{location}/#{app}-*.conf"] << "#{location}/#{app}.conf").each do |file|
clean file
end
+12
View File
@@ -38,6 +38,18 @@ describe Foreman::Export::Upstart, :fakefs do
upstart.export
end
it "does not delete exported files for similarly named applications" do
FileUtils.mkdir_p "/tmp/init"
["app2", "app2-alpha", "app2-alpha-1"].each do |name|
path = "/tmp/init/#{name}.conf"
FileUtils.touch(path)
dont_allow(FileUtils).rm(path)
end
upstart.export
end
it "quotes and escapes environment variables" do
engine.env['KEY'] = 'd"\|d'
upstart.export