From 6750aeb90a4d19a2cd1de3ff007f216d31c4e65d Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 1 Sep 2009 00:12:07 -0700 Subject: Fixing #2563 - multiple regex nodes now work together The problem was that we were needing to convert one of the regexes to a string, which wasn't working well. This adds specific rules for how regexes vs. strings get compared. Signed-off-by: Luke Kanies --- lib/puppet/parser/ast/leaf.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb index 1c1eae972..d10ea62f4 100644 --- a/lib/puppet/parser/ast/leaf.rb +++ b/lib/puppet/parser/ast/leaf.rb @@ -119,8 +119,18 @@ class Puppet::Parser::AST end def match(value) - value = value.value if value.is_a?(HostName) - return @value.match(value) + return @value.match(value) unless value.is_a?(HostName) + + if value.regex? and self.regex? + # Wow this is some sweet design; maybe a touch of refactoring + # in order here. + return value.value.value == self.value.value + elsif value.regex? # we know if the existing name is not a regex, it won't match a regex + return false + else + # else, we could be either a regex or normal and it doesn't matter + return @value.match(value.value) + end end def regex? -- cgit