Le 27/10/2015 11:12, Christopher Wood a écrit :
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

I think it is different. In my example, there is no hiera involved.
My problem is :
I want my class param value to be 'undef', and not it being 'use the default value'

There is no way to set a class param value to undef if there is default value for it different from undef.

Thanks anyway


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/562F5AEE.8040007%40cea.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to