Hi Jay,

You could simplify things a little using 'unless' which acts like the
reverse of 'if'. You'd place your resources within the unless block so that
they'd only be included in your catalog if your Fact or variable evaluated
to false.
http://docs.puppetlabs.com/puppet/3/reference/lang_conditional.html#unless-statements

I suspect this isn't exactly what you're looking for I wanted to take this
opportunity to remind you that Puppet 3.2 introduced an experimental future
parser that makes it pretty simple to collect and iterate over things.
Maybe it'll help at some point down the road.
http://docs.puppetlabs.com/puppet/3/reference/lang_experimental_3_2.html

Hope that helps,
--Ryan

On Wed, Oct 9, 2013 at 6:13 PM, Jay <jayachandran...@gmail.com> wrote:

> Hi,
>
> I have a puppet module with more than 15 blocks of resources.. based on a
> validation I want puppet to decide to continue next blocks or skip with a
> warning(with out failing).
>
> currently I am doing this with a big if block.
>
> class mymodule {
>   if $::flag_enabled {
>     package {...}
>
>     files {...}
>     ....
>   }
>   else
>   {
>     warning("Flag is disabled")
>   }
> }
>
> Is there a way to skip the module something like this?
>
> class mymodule {
>
>   if not $::flag_enabled {
>     warning("Flag is disabled, skipping mymodule")
>     //skip executing below resources
>   }
>   package {..}
>   file {...}
> }
>
> Appreciate your help on this.
>
> Regards,
> Jay
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Ryan Coleman | Modules & Forge | ryanycoleman on twitter & #puppet IRC

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to