FAQ

On Mon, 2013-01-28 at 08:24 -0800, Ti Leggett wrote:
I have one module, kibana, that defines a file snippet for the apache
module to fulfill (e.g., /etc/https/conf.d/kibana.conf). The apache::params
class defines a variable of the path of where this snippet should be
placed, $config_d. The snippet uses this variable in its definition.
However, it seems that the snippet never resolves the
$apache::params::config_d variable, and I'm guessing because the order of
instantiation isn't right. I've tried requiring the apache class from the
snippet, which seems it would enforce proper ordering, and I've tried
inheriting the kibana::apache class from apache::params. The former still
doesn't resolve and the latter throws an agent error. What is the proper
way for using a variable in one class in another class when
manifests/nodes.pp definitions of the classes can't be guaranteed?

Here are snippets of the class definitions I'm using:
http://pastie.org/5910079
Variable references like $apache::params::config_d are parse-order
dependant. The class apache::params has to be parsed on the master
before you reference the variable. (Order of application doesn't matter,
so you don't need to use 'require')

The fix is trivial, just add an "include apache::params" (or even just
"include apache") at the top of your kibana::apache class, like so:

# modules/kibana/manifests/apache.pp
class kibana::apache (
$version = $kibana::params::parameters['version'],
) {
include apache::params
@file { $kibana::params::apache_config:
...

However, this conflicts with the class {} style declarations in your
apache/manifests/init.pp file. For best results, you should switch those
to use the "include" method as well.

--
Calvin Walton <[email protected]>

--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 19 | next ›
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJan 28, '13 at 4:26p
activeJan 31, '13 at 2:39p
posts19
users5
websitepuppetlabs.com

People

Translate

site design / logo © 2023 Grokbase