diff options
author | Luke Kanies <luke@madstop.com> | 2009-09-01 00:12:07 -0700 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-09-01 00:12:07 -0700 |
commit | 6750aeb90a4d19a2cd1de3ff007f216d31c4e65d (patch) | |
tree | b2afd8bf2bf30f7ec3c084f995c7b2df6eebc0fa /lib/puppet/parser/ast/leaf.rb | |
parent | b728b931e5914cfeaf3d072fb77870e9a8ecf6cd (diff) | |
download | puppet-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.rb | 14 |
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? |