开发者

Run another task within capify and specify host

EDIT: rephrasing the question

Say you have two tasks. The first one determines a host name dynamically, and wants to invoke the second class only on that host.

task :first_task do
  host_name = ... 
  second_task, :hosts => hostname
end

task :second_task do
  run "some stuff"
end

As far as I can tell passing in :hosts doesn't work. Assigning the new host_name to a开发者_JAVA百科 role, and having the second task use those roles would work, but that won't work on existing tasks. This does seem to be possible as the default deploy:setup works on passing in a HOSTS variable, but I can't figure out how that works.


Well, a bit late for it to matter, but... You could try:

task :first_task do
  host_name = ... 
  set :hosts, host_name
  second_task
end

task :second_task do
  run "some stuff", :hosts => fetch(:hosts)
end


Passing in a HOSTS variable is ENV['HOSTS'] if you look more closely.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜