Unless there have been any developments of which I am unaware, you would need 
to handle this in the code+hiera. Here's where I dribbled all over this thing a 
few months ago:

https://groups.google.com/forum/#!msg/puppet-users/0l3m4VCHjOg/KKlz5LNpCgYJ

On Tue, Oct 27, 2015 at 10:03:19AM +0100, DEGREMONT Aurelien wrote:
> Hello
> 
> When using class parameters I often face the same issue regarding undef
> usage.
> Let's say I got this simple class:
> 
> class foo (
>   $service_ensure = 'running',
> ) {
>   service { 'foo':
>      ensure => $service_ensure;
>   }
> }
> 
> 
> include foo # will set the service running
> 
> 
> class { 'foo':
>   service_ensure => 'stopped'; # will set the service stopped
> }
> 
> 
> And now, I would like to say 'do not care about ensure'. Do not touch it.
> For that, I need that ensure is set to 'undef'
> 
> But I cannot use:
> 
> class { 'foo':
>   service_ensure => undef;
> }
> 
> because in this case, Puppet will use the default value of the parameter, in
> this case: running.
> 
> I have this problem for a lot of different modules and I looking for a
> simple way to do this.
> I would like to avoid adding an if/else in all my classes.
> 
> 
> Thanks in advance
> 
> Aurélien
> 
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/562F3DD7.8010008%40cea.fr.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20151027101241.GA18006%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to