jcbollinger wrote:

> On Saturday, June 4, 2016 at 7:20:19 PM UTC-5, Helmut Schneider wrote:
> > 
> > Hi, 
> > 
> > I'm new to puppet and read docs as much as possible, so forgive
> > some confusion in my code. 

[Code]

> Consider this call:
> 
> hiera_array ('apacheModules', '', 'ubuntu-common')
> 
> It performs an array-merge lookup for key 'apacheModules', with
> hierarchy level 'ubuntu-common' inserted at the top of the hierarchy.
> That level is already in the hierarchy for the node, or so I must
> presume.  Now remember that an array-merge lookup collects data from
> every level in the hierarchy, so if that duplicate level contains any
> data for the requested key then you will automatically get dupes for
> all those data.
> 
> Even if you weren't getting dupes by virtue of having the same
> hierarchy level consulted twice, it looks like you have a second
> avenue for dupes.  You are performing two array-merge lookups and
> then concatenating the results.  Since each array-merge lookup will
> collect data from the whole hierarchy (plus, in your case, an extra
> level), the two sets of results you are concatenating will have many
> elements in common, so concatenating them produces dupes.

This in fact wasn't clear to me, I thought it would restrict the serach
to ubuntu-common.yaml and not extend it.

> In fact, even your 'case' statement is a bit suspect.

Without the case statement, how can I make sure that ubuntu only
receives classes for ubuntu and not e.g. for Windows then?

> With appropriate use of fact interpolation in your hierarchy
> definition, you should be able to reduce [the section you presented
> of] your nodes.pp to just this:
> 
> $packages = hiera_array ('packages', [])
> $apacheModules = hiera_array ('apacheModules', []) 
> hiera_include ('classes') 
> install-packages { $packages: }
> apache24::modules { $apacheModules: }

Works like a charm btw.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/xn0k6yybesbrkfk000%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to