fix supervisord export for environments containing commas
This commit is contained in:
@@ -5,7 +5,7 @@ engine.procfile.entries.each do |process|
|
|||||||
1.upto(self.concurrency[process.name]) do |num|
|
1.upto(self.concurrency[process.name]) do |num|
|
||||||
port = engine.port_for(process, num, self.port)
|
port = engine.port_for(process, num, self.port)
|
||||||
name = if (conc > 1); "#{process.name}-#{num}" else process.name; end
|
name = if (conc > 1); "#{process.name}-#{num}" else process.name; end
|
||||||
environment = (engine.environment.map{ |var,env| "#{var.upcase}=#{env}" } + ["PORT=#{port}"])
|
environment = (engine.environment.map{ |var,env| "#{var.upcase}=#{wrap_environment env}" } + ["PORT=#{port}"])
|
||||||
app_name = "#{app}-#{name}"
|
app_name = "#{app}-#{name}"
|
||||||
app_names << app_name
|
app_names << app_name
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -23,4 +23,12 @@ class Foreman::Export::Supervisord < Foreman::Export::Base
|
|||||||
write_file "#{location}/#{app}.conf", app_config
|
write_file "#{location}/#{app}.conf", app_config
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def wrap_environment env
|
||||||
|
if env.index(',').nil?
|
||||||
|
env
|
||||||
|
else
|
||||||
|
"\"#{env}\""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,4 +72,14 @@ describe Foreman::Export::Supervisord, :fakefs do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "environment export" do
|
||||||
|
it "returns the original environment if it contains no comma" do
|
||||||
|
supervisord.wrap_environment("production").should == "production"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "wrapps the original environment with quotes if it contains a comma" do
|
||||||
|
supervisord.wrap_environment("slowqueue,fastqueue").should == '"slowqueue,fastqueue"'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user