logo       

Re: Template Nodes considered harmful: msg#00233

sysutils.puppet.user

Subject: Re: Template Nodes considered harmful

On Oct 22, 2007, at 9:08 AM, <Derek.Whayman@xxxxxxxxxxxxxxxxxxx> wrote:

> Although I've been lucky enough not to have been stung (all of my
> config
> hangs off the base class), I thought (perhaps naively) that the
> external_nodes variables were like facts, in that they were applied
> globally.
>
> I just trawled the mailing lists as I could swear that there was some
> discussion about this some months ago, but no, just the usual stuff
> about inheritance and scope.
>
> Any other opinions???

Ah! Reading the "Could not find value for" thread helped me solve
the problem.

The 'main' class, which includes all of the code outside of all other
classes, is evaluated before the node is evaluated, which is why
you're seeing that behaviour. You wouldn't get the variable value in
the 'base' class unless the variable were set in the top-level scope,
but you're still dealing with an ordering issue.

Looks like I should reverse things and evaluate the node first if
there is one, so that you don't have that ordering issue.

This whole 'main' class thing keeps getting more complicated, which
is quite surprising to me.

--
I do not feel obliged to believe that the same God who has endowed us
with sense, reason, and intellect has intended us to forgo their use.
-- Galileo Galilei
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise