I do not think what you want exists. It makes sense, as a class is not a
procedural list of commands to execute, but a collection of resources, so a
way to "exit early" does not really exist. If you just want to avoid the
extra indentation and potentially misplaced closing bracket, how about this
pattern:
class somemodule {
if $load_module = true {
include somemodule::load
}
}
class somemodule::load {
// potentially very long module
}
- Chad
On Mon, Dec 17, 2012 at 3:02 PM, Philip Brown <[email protected]> wrote:
> Hi folks,
> I've poked around the language reference, and havent found anything on
> this so far. I'd like to be able to force a clean early exit from a module.
> WITHOUT encasing the whole body of the module in an if statement.
>
> What I'm looking for:
>
> class somemodule {
> #no this isnt going to be a global variable I'm just using that as an
> example,
> if $dont_load_module {
> return happy
> }
> // blah blah normal module goes on here
> }
>
> What I'd like to AVOID:
>
> class somemodule {
> if $dont_load_module != true {
> // body of module
> // potentially very long
> // goes
> // here
> }
> }
>
>
> I know there are a few different ways to skin this cat that come at the
> issue from a different angle; however, I'd appreciate a direct puppet
> language solution, rather than "go restructure the way you load modules via
> ENC/blahblah", if possible.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/F0HcnaYmK8YJ.
> 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.
>
--
Chad M. Huneycutt
--
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.