On Wed, June 17, 2009 11:53, Thomas Bellman wrote:
>
> Brice Figureau wrote:
>
>> I've almost finished node matching, even though I'm not really satisfied
>> of how it works. Node matching is O(1) for the moment, but as soon as
>> you
>> add regexp in the mix, it becomes essentially O(n) :-(
>
> I suppose Puppet currently builds a hash table of the node entries when
> it compiles the manifests?  You could then still keep the hash table for
> node statements with fixed, non-regexp, names, and try a lookup in that
> table first for nodenames, and only check the list of regexps if the hash
> lookup fails.  Then you only incur the O(n) penalty if you actually use
> regexp node statements.  And most sites will probably only have a few
> such statements (even if they match many, many, hosts), so I think it
> won't be a large practical problem.

Yes, that's how I designed it. Still as soon one node uses a regex, you
incur the O(n) penalty.

> Or have I misunderstood what the problem is?  I haven't looked into how
> Puppet actually works at that level.
>
> Don't forget to document what happens when multiple node statements match
> a hostname.

The first parsed one will be picked-up. If not appropriate we can try
something else, like the longest match or sth like that...
-- 
Brice Figureau
Days of Wonder


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

Reply via email to