On Sep 16, 2009, at 11:19 AM, Brice Figureau wrote:

> When we are checking if a node exists before creating a new one
> we were also trying to match with regex node names, finding matches
> where in fact there is no equality.

Hi Brice, thanks for the patch. I pulled the latest from master for  
testing. This does indeed fix the parse failure I filed the bug about,  
but I'm not sure if it achieves the goal I was shooting for. Can you  
help me understand if I am asking for something stupid? (I have to  
qualify all of this with self-doubt because I'm coming off a ten-year- 
long cfengine habit and my thinking may be warped beyond help!)

At a high level I was hoping to use regexp matching to make puppet  
nodes.pp akin to cfengine's 'classes' section, where you'd set up user- 
defined names for later use by matching hostnames, IPs or whatnot. So  
my thought was I'd match different parts of the hostnames to include  
the right puppet classes, kind of like pulling the external node  
classifier functionality into static files.

If that goal is legitimate, my next question is whether these tests  
are legit. I made four test cases to cover permutations of the two  
things that seemed to matter: two regexp vs regexp+quoted nodename,  
and quoting-first vs quoting-second. I expect the notices should fire  
as each stanza is entered, which is a simplification to the real goal  
of 'include'-ing various classes in each node stanza, to compose the  
right list for a given node.

With the new code, I don't get parse failures but in no case do I get  
two notices emitted.


[[email protected] ~/Sandbox/dotmac/puppet/etc/sandbox]% for f  
in node???-?regexp.pp ; do echo "### $f " ; cat $f; puppet $f ; done
### node1st-1regexp.pp
node "recury.explosive.net" {
     notice "we are recury"
}

node /^(a|b|c|d|j|r)/ {
     notice "we start with a,b,c,d,j,r"
}

notice: Scope(Node[recury.explosive.net]): we are recury
### node1st-2regexp.pp
node /recury/ {
     notice "we are recury"
}

node /^(a|b|c|d|j|r)/ {
     notice "we start with a,b,c,d,j,r"
}

notice: Scope(Node[recury.explosive.net]): we are recury
### node2nd-1regexp.pp
node /^(a|b|c|d|j|r)/ {
     notice "we start with a,b,c,d,j,r"
}

node "recury.explosive.net" {
     notice "we are recury"
}
notice: Scope(Node[recury.explosive.net]): we are recury
### node2nd-2regexp.pp
node /^(a|b|c|d|j|r)/ {
     notice "we start with a,b,c,d,j,r"
}

node /recury/ {
     notice "we are recury"
}
notice: Scope(Node[recury.explosive.net]): we start with a,b,c,d,j,r


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to