On 3/8/09 7:39 PM, S. Robert James wrote:
> 
> 
> On Mar 8, 9:09 pm, Jamis Buck <[email protected]> wrote:
>>> So, if a task doesn't use "run" or the like, its invocation will be
>>> identical, even after we define multiple roles.
>>> Is that correct?
>> Possibly, but I'm not sure what you mean. :)
> 
> Thanks, Jamis, for the quick response.  What I mean here is, let's say
> I have a task:
> task :notify do
>   mail [email protected] -s "It worked!" # Uses my local box's mail
> command
> end
> 
> That task will only run once - that is, we'll only get one mail - even
> though there a dozens of matching servers, since the tasks aren't
> multiplexed, only the run/sudo methods.  But if I were to modify the
> above code to use "run" command, we'd get one mail from each matching
> server.  Is that accurate?

Right. But you can explicitly loop over the matching servers like this:

  find_servers_for_task(current_task).each do |server|
    puts "doing something on #{server.host}..."
    # do something
  end

- Jamis

> > 


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to