Hi,

I am trying to pass an option via the command line switch -S to run a
capistrano task on specific set of machines. For example:

cap -S subset=slave_subset_b start_slave_subset

Should run the task "start_slave_subset" on machines specified by
slave_subset_b. Is there a way to do this? At the moment my Capfile
looks like:

role :slave_subset_a, "test02", "test03", "test04", "test05", "test06"
role :slave_subset_b, "test07"
role :slave_subset_c, "test02"

role(:get_dynamic_roles) {
  servers=[]
  if #{slave_subset_a} == #{subset}
    servers=roles[:slave_subset_a].servers
    print "matched subset_a\n"
  elsif #{slave_subset_b} == #{subset}
    servers=roles[:slave_subset_b].servers
    print "matched subset_b\n"
  elsif #{slave_subset_c} == #{subset}
    servers=roles[:slave_subset_c].servers
    print "matched subset_c\n"
  else
    print "matched nothing\n"
  end
  servers
}

desc "Starts slave processes."
task :start_slave_subset, :roles => :get_dynamic_roles do
  print "subset = #{subset}"
  run <<-CMD
   #{install_dir}/current/bin/random-wait.sh 5 &&
   #{install_dir}/current/bin/start.sh
  CMD
end


When I run the cap command (above) it seems like it arbitrarily
matches one of the 4 else blocks, as if there is some uninitialized
variable. Is there a way to do what I'm trying to do ?

-Sanjit

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to capistrano@googlegroups.com
* To unsubscribe from this group, send email to 
capistrano+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to