On Wed, Sep 29, 2010 at 10:20 AM, Héctor Rivas Gándara <key...@gmail.com> wrote:
> On Wed, Sep 29, 2010 at 3:46 PM, Bruce Richardson <itsbr...@workshy.org> 
> wrote:
>> On Wed, Sep 29, 2010 at 02:59:28PM +0200, Héctor Rivas Gándara wrote:
>>> Also, from my tests I checked that the parameters (please correct me if I am
>>> wrong):
>>>  - Are stored in global scope: All classes has access to it.
>>
>> No.  The parameters have "node" scope.  Any class included within the
>> node will be able to see the node's values.
>
> Ok, thanks.
>
> But I still don't have really clear the different scopes. Do you know
> any clear documentation about it. A simple diagram like this woud be
> great:
>
>  Scope precedence: Subclass => Included Class => Parent Class =>
> Global => Node??
>
>>> But I do not like too much the extlookup solution because:
>>>  * I can not define a common subset of groups that all host will inheret
>>> (except the ones that overwrite this value). May be using again the
>>> "default_connect_allowed_groups" variable.
>>
>> There's no nice way to do it.  Aas I understand it, Puppet's external
>> nodes code doesn't support arrays, let alone appending to arrays.  Every
>> time I look at using external node classifiers, I walk away from it
>> again.  If I were managing sites of such a scale that it were
>> unavoidable, I'd be an unhappy person (time to dust off the Ruby
>> skills).
>
> First: I have to say you that external nodes DOES support arrays, just
> writing [ 'a', 'b', 'c' ]
>
> Well, I think that a fast solution could be create a "wrapper" script
> (an script that parses and modifies the output of the other) for
> external nodes that would implement simple inheritance and other
> parameter substitution.
> We could add a section "super: <name>" and allow the use of reference
> to other parameters (of actual node or parents) into the parameters.

We have simple inheritance in our external node classifier like this:

# nodes/foo.mydomain.yaml

includes:
  - pillar
  - puppetmaster
parameters:
  puppetmaster_role: catalog_server

# nodes/includes/puppetmaster
---
classes:
  - puppetmaster
parameters:
  puppetmaster_track: stable
  puppetmaster_role: catalog_server
  puppet_development: false
  puppet_autotest: false


We only allow one level, and includes cannot include other includes.
Parameters specified in a node yaml override the same parameter in an
include yaml.

Oh, and we have a default node that all of this is appended to.

This is a really simple classifier, less than 100 lines of real code.

>
> Something like this:
>
>   - name: linuxserver
>      parameters:
>       connect_allowed_groups: ["group1", "group2"]
>      classes:
>       - linux
>
>   - name: node1.mydomain.com
>      super: linux
>      parameters:
>       connect_allowed_groups: %{connect_allowed_groups}+["group3"]
>
>   - name: node2.mydomain.com
>      super: linux
>      parameters:
>       connect_allowed_groups: ["group1", "group3"]
>
> This way we could easily implement inheritance in all external nodes
> implementations.
> --
> Atentamente
> Héctor Rivas
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>
>



-- 
nigel

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to