On Feb 14, 2008, at 10:30 AM, mzorova wrote:

Sorry - I think I misphrased the question - the problem IS reproducing
now - the issue is that the child tasks are not filtered by the CALLER
task's filters. Which is the reverse of my earlier question, and I
guess your first answer applies to my real question - and that it is
by design.. So essentially, you cannot have re-usable sub functions,
you need to define separate functions for each filter.

If you want reusable sub functions, define them as functions and not as tasks, e.g.:

  task :foo, :roles => %w(a b) do
    do_this_first
    do_this_next
  end

  def do_this_first
    run "echo do this first; hostname"
  end

  def do_this_next
    run "echo do this next; hostname"
  end

The do_this_first and do_this_next methods are called within the scope of the :foo task, and so any run commands called from there will "inherit" the roles restriction of the :foo task. If you want those methods to be callable as standalone tasks as well, just define tasks that wrap them:

  task :do_this_first_task do
    do_this_first
  end

  task :do_this_next_task do
    do_this_next
  end

On a related note, can you over-ride tasks for only certain filters?
It did not seem to work, but just thought I would ask to make sure
anway. It seems to override the filters for the entire task, instead
of overriding the task for the specified filter.

I'm not sure what you mean by "filter". Can you give a concrete example of what you have in mind?

- Jamis

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to