On 09/02/10 14:14, Rafael G. wrote:
> Robin Bowes wrote:
>> Is it possible to make tasks optional, ie. so they simply don't execute
>> if no hosts are returned for their roles?
>>
> Try adding on_error parameter to your task. Example:
>  task :foo, :on_error => :continue do
>    ...
>  end

Rafael,

Thanks - that worked, but I don't really want to trap errors like that -
if the task actually does fail when running on a machine that exists I
want to be notified.

What I'd like is for :foo to be a noop if :foo_roles is empty

eg, given this:

    task :set_data_perms, :roles => [:partition] do
        print "    setting ownership of data dir.\n"
        run "chown statcounter:statcounter #{release_path}/data"
    end

if :partition is empty, :set_data_perms should just not do anything
rather than fail and complain that :partition is empty.

Is that currently possible? If not, is it a change that might be
considered? I'd offer a patch but a) my ruby-foo is not good enough, and
b) my knowledge of capistrano is not sufficient.

R.

-- 
* 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