On Friday, January 10, 2014 5:04:50 PM UTC-6, Jeffrey Lewis wrote:
>
> Hello,
>
> I apologize in advance if this question is redundant.
>
> I'm using puppet version 2.7.11 (because that's what Ubuntu 12.04 LTS has
> to offer) and I'd like to override a class default parameter with 'undef'.
> For example, the puppetlabs 'apache' module (version 0.10.0) sets 'ensure
> => running' for service 'apache' by default. I do not what puppet to
> attempt starting or stopping apache, so I'm trying the following (which
> does not work):
>
> class {
> 'apache': service_ensure => undef;
> }
>
> The above gives me the default 'ensure => running' for the 'apache'
> service. Any idea how I can express 'ensure => undef' when declaring the
> apache class in my manifest?
>
>
All class parameters must have values assigned, whether by explicit
declaration or by default value (or by automated data binding, but that
requires Puppet 3). Undef is not a value. In fact "not a value" is
practically its definition. Declaring a class or resource parameter as
undef is an explicit expression of not assigning a value. That can
actually make a difference in the presence of declared resource-type
defaults (e.g. File { owner => 'root', mode => 0644 } ), but what you're
fighting with is a different kind of default -- the one assigned when there
is no explicit value declared. That is exactly the situation you present
by declaring the parameter undef.
> Could suppose I could always hack the 'apache' module, but would prefer
> not to.
>
>
Check the module documentation, but it sounds like the stock version does
not support what you want to do. David's suggestion to override
Service['apache'] might succeed for you or it might not, as there could be
other effects of the 'service_ensure' parameter, and the title of the
relevant Service resource doesn't have to be 'apache'. Either way, it is
poor form to touch module internals, such as the putative
Service['apache'], except as module documentation supports.
David's might still be the approach that works best for you. Personally,
though, I would look into modifying the module appropriately, then opening
an issue against it and contributing your solution. Perhaps you could make
an empty value of service_ensure suppress managing the run state of the
service.
John
--
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/7122b1f4-655b-4bc2-9ab3-0b719de74f00%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.