On Mar 30, 9:02 am, Pablo Fernandez <[email protected]> wrote:
> I have trying to dig more into this, and I found out the problem is not
> the scope of the variable, but hiera!
>
> So, it seems like hiera('netmask') is actually looking into the node's
> facts! Is this the expected behavior?
>
> This is my hiera.yaml:
> :backends:
> - puppet
>
> :hierarchy:
> - %{hostname}
> - %{environment}
> - group_%{group0}
> - group_%{group1}
> - group_%{group2}
> - group_%{group3}
> - group_%{group4}
> - group_%{group5}
> - group_%{group6}
> - group_%{group7}
> - group_%{group8}
> - group_%{group9}
That long list of numbered groups looks pretty kludgey, but I don't
think that's the root cause of your problem.
> :puppet:
> :datasource: data
>
> Most of those classes don't even exist. And data::myhost certainly doesn't.
>
> And the place it should be looking into the right variable is:
> class data::group_all {
> $netmask = "255.255.252.0"
>
> }
>
> (in this case, $group1='all')
Only in a loose sense. It may be that $::group1 = 'all', but the
local variable $group1 is not defined in your example context.
>From where the $group1 variable is resolved could be a key question.
Is it a fact or a global variable? Those ought to work. If it's
declared in the node declaration, however, then that might be your
problem: I'm not sure whether those would work in Puppet 2.7 (or
earlier). They almost surely will not work in Telly, so you should
avoid building solutions around them.
Also, are you certain that data::group_all is the first existing class
in hierarchy order? Does the node's $group0 not correspond to an
existing data class? What about data::%{environment}? Is there a
"data::group_" class that might be checked when one of the $groupN
variables is undeclared or has an empty value?
> I have tried, for the sake of testing, to change the variable to
> something different (and the hiera lookup) and it does the right thing,
> so I am quite sure it's actually conflicting with the "netmask" fact.
>
> Any ideas?
My guess is that there is an existing class higher in the hierarchy
than data::group_all ends up being, and although that class doesn't
declare a 'netmask' variable itself, lookup relative to that class
pulls in $::netmask (because it is in-scope there).
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.