Is it possible to pass an OR conditional into the :only check?  I know that
it expects an array of key/value pairs so you can essentially do an AND
inside of the hash, but what if you want to check on multiple keys in the
conditional?

Example:

I have ten servers in a bank that are all serving the application.  At any
point in time, only the :primary and the :secondary should have actions
performed on them.  Through capistrano definitions I have managed to pass
:primary => true and :secondary => true into those two servers, such that
(stripped all the other servers out of the array to save space):

[
#<Capistrano::ServerDefinition:0x101968618
    @hash=-2051751815,
    @host="server21.domain.com",
    @options={:secondary=>true},
    @port=nil,
    @to_s="[email protected]",
    @user="user">,
#<Capistrano::ServerDefinition:0x10194ad98
    @hash=6964762022,
    @host="server20.domain.com",
    @options={:primary=>true},
    @port=nil,
    @to_s="[email protected]",
    @user="user">,
#<Capistrano::ServerDefinition:0x10194cb20
    @hash=-447395779,
    @host="server22.domain.com",
    @options={},
    @port=nil,
    @to_s="[email protected]",
    @user="user">,
]

If I want to run a task *only* on those two (the list is much longer, just
stripped for this example), is there some iteration of :only that allows me
to do that?  I have attempted:

task :test, :roles => [:app], :only => {:primary => true} || {:secondary =>
true} do; run "hostname"; end

But it only executes on the first matching hash of k,v pair.  And of
course, if you do:

task :test, :roles => [:app], :only => {:primary => true, :secondary =>
true} do; run "hostname"; end

It will attempt to match both k,v pairs.  Anyone have any suggestions?
 It's probably just something syntactical that I'm totally overlooking.

Thanks in advance,
Chris.

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

Reply via email to