summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/leaf.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-09-01 00:12:07 -0700
committerLuke Kanies <luke@madstop.com>2009-09-01 00:12:07 -0700
commit6750aeb90a4d19a2cd1de3ff007f216d31c4e65d (patch)
treeb2afd8bf2bf30f7ec3c084f995c7b2df6eebc0fa /lib/puppet/parser/ast/leaf.rb
parentb728b931e5914cfeaf3d072fb77870e9a8ecf6cd (diff)
downloadpuppet-6750aeb90a4d19a2cd1de3ff007f216d31c4e65d.tar.gz
puppet-6750aeb90a4d19a2cd1de3ff007f216d31c4e65d.tar.xz
puppet-6750aeb90a4d19a2cd1de3ff007f216d31c4e65d.zip
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 <luke@madstop.com>
Diffstat (limited to 'lib/puppet/parser/ast/leaf.rb')
-rw-r--r--lib/puppet/parser/ast/leaf.rb14
1 files changed, 12 insertions, 2 deletions
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?