Prevent upstart export from deleting similarly named upstart files
This commit is contained in:
@@ -6,7 +6,7 @@ class Foreman::Export::Upstart < Foreman::Export::Base
|
|||||||
def export
|
def export
|
||||||
super
|
super
|
||||||
|
|
||||||
Dir["#{location}/#{app}*.conf"].each do |file|
|
(Dir["#{location}/#{app}-*.conf"] << "#{location}/#{app}.conf").each do |file|
|
||||||
clean file
|
clean file
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,18 @@ describe Foreman::Export::Upstart, :fakefs do
|
|||||||
upstart.export
|
upstart.export
|
||||||
end
|
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
|
it "quotes and escapes environment variables" do
|
||||||
engine.env['KEY'] = 'd"\|d'
|
engine.env['KEY'] = 'd"\|d'
|
||||||
upstart.export
|
upstart.export
|
||||||
|
|||||||
Reference in New Issue
Block a user