logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Template Nodes considered harmful: msg#00230

Subject: Re: Template Nodes considered harmful
I finished implementing a simple external_nodes system today, and am
pleased with the convenience it allows in setting node- (or group-)
specific parameters.

However, following some chatter on #puppet and on this ML, I was
surprised to find that variables set this way are not visible in the
global scope.  E.g.

# cat /etc/puppet/manifests/site.pp:
notice "Global scope myvar = $myvar"

class base {
    notice "Base class myvar = $myvar"
}

# /var/lib/puppet/tools/node_classifier
engpsr0142.intranetdev.barcapdev.com
---
classes:
  - base
parameters:
  myvar: 4

When I run puppetd I see this:

Oct 22 14:34:46 engpsr0000 puppetmasterd[3776]: (main[top]) Global scope
myvar = 
Oct 22 14:34:53 engpsr0000 puppetmasterd[3776]: (base) Base class myvar
= 4

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???

Derek


-----Original Message-----
From: puppet-users-bounces@xxxxxxxxxxx
[mailto:puppet-users-bounces@xxxxxxxxxxx] On Behalf Of David Schmitt
Sent: 22 October 2007 13:36
To: Puppet User Discussion
Subject: Re: [Puppet-users] Template Nodes considered harmful

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 16 October 2007, Luke Kanies wrote:
> On Oct 16, 2007, at 4:35 AM, David Schmitt wrote:
> > MY proposed solution is to change all template nodes into template 
> > classes and
> >
> > instead of inheritance use inclusion:
> > | class genericwebserver { stuff }
> > |
> > | $influence_genericwebserver = "site default"
> > |
> > | node 'web01.example.com' {
> > |   $influence_genericwebserver = "node specific override"
> > |   include genericwebserver
> > | }
> >
> > As shown in the example, this allows for site defaults and per-node 
> > overrides for variables which will be propagated to the 
> > genericwebserver.
>
> Note that this is still file-order dependent, unfortunately -- if that

> class was already included elsewhere, then the variable override won't

> take.

I would have hoped, that this can be mostly circumvented by using
external node support, which my node-configuration style is modelled
after. This would set the relevant variables before any class can be
included. Also the variables from the script could - theoretically - be
made readonly like facts, which would make them "safe" for usage
classes.

David Escala called my attention on IRC today on the fact that variables
set via external nodes seem to be set on node scope and not really
global. (See also the thread "client update to 0.23.2: "Could not find
value for""). This makes the whole thing a bit confusing.




Regards, David
- --
The primary freedom of open source is not the freedom from cost, but the
free- dom to shape software to do what you want. This freedom is /never/
exercised without cost, but is available /at all/ only by accepting the
very different costs associated with open source, costs not in money,
but in time and effort.
- --
http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHHJkn/Pp1N6Uzh0URAhhtAJ9Io/Kp5irRBxT6nKQqMoyjK0UiggCeOmOP
xYLWHPz8X3iDJDzqdniAQtA=
=BSEj
-----END PGP SIGNATURE-----
_______________________________________________
Puppet-users mailing list
Puppet-users@xxxxxxxxxxx
https://mail.madstop.com/mailman/listinfo/puppet-users
------------------------------------------------------------------------
For important statutory and regulatory disclosures and more information about 
Barclays Capital, please visit our web site at http://www.barcap.com.

Internet communications are not secure and therefore the Barclays Group does 
not accept legal responsibility for the contents of this message.  Although the 
Barclays Group operates anti-virus programmes, it does not accept 
responsibility for any damage whatsoever that is caused by viruses being 
passed.  Any views or opinions presented are solely those of the author and do 
not necessarily represent those of the Barclays Group.  Replies to this email 
may be monitored by the Barclays Group for operational or business reasons.

Barclays Capital is the investment banking division of Barclays Bank PLC, a 
company registered in England (number 1026167) with its registered office at 1 
Churchill Place, London, E14 5HP. This email may relate to or be sent from 
other members of the Barclays Group.
------------------------------------------------------------------------


<Prev in Thread] Current Thread [Next in Thread>