On 18 December 2012 10:21, Philip Brown <[email protected]> wrote: > > > On Monday, December 17, 2012 3:18:26 PM UTC-8, Jakov Sosic wrote: >> >> >> >> Puppet is not procedural but declarative language, so you can only >> declare states. > > > Except that is not strictly true. > There is an early-exit "fail" directive that can be used conditionally. > So why not a conditional early exit from a module, that allows other > modules to keep going? > Perhaps it would help if I rephrased "exit" as some other more > state-friendly language, but nothing is coming to mind at the moment. >
The most important question is what are you trying to achieve? >From what I can tell from your post you are putting the decision on whether to include the resources in a module in the wrong place. If the module shouldn't be included in a node don't include it in the node declaration. Deciding that in the module is the wrong place especially if you are excluding the all the resources in a module for one (or even a few) cases. You need to switch your thinking when writing puppet modules. Trying to write procedural code in a declarative environment will cause all kinds of headaches. (I know because It took me a bit to understand how it worked) Admittedly you can use mildly procedural constructs in your modules and classes and such but it's not quite the same because the resources within those constructs won't be "executed" in the order you write them either. The "Order" puppet applies the resources to a node is dependent on the relationships between the resources (require, before, subscribe and the like). I hope that sheds some light on your issue. If you want to provide some more details on what you are trying to achieve I am happy to help you work out the best way to realise it. Pete. -- You received this message because you are subscribed to the Google Groups "Puppet Users" 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-users?hl=en.
