On Oct 26, 2009, at 8:44 AM, Roy Nielsen wrote:

> Hello,
>
> I'm working on adding a parameter to a type.  If a condition is met,  
> skip the resource & keep processing.  At least that's what I'd like  
> to do.
>
> I can get the condition met, but the only thing I can get to work is  
> to use Puppet::Error, or Puppet::DevError - which exits the puppet  
> run.
>
> Someone pointed out the transaction class, but I'm having a bit of  
> trouble figuring out how to use it.  The exec parameter has the  
> "unless" and "onlyif" parameters, but it's not clear how they are  
> accomplishing it.
>
> Anyone have any pointers?

Look in the transaction for the 'skip?' method -- this is where you  
should have the transaction check to see if a resource passes all of  
its checks.

E.g., you'd have a method like this on the resource:

   def passes_checks?
     ...iterate over each provided check and run it...
   end

And in the transaction:

   def skip?
     ...existing code...
     elsif ! resource.passes_checks?
       return false
     ...
   end

With tests, of course. :)

-- 
I don't know the key to success, but the key to failure is trying to
please everybody. -- Bill Cosby
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to