From b643413da520fabb7ee81e8c710e30f43bc1475b Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 9 Apr 2010 16:02:32 -0700 Subject: Removing any mentions of :casesensitive setting It is a setting that was added years ago as a backward compatibility option and even if it still works, which is questionable, it has no purpose any longer. It just complicated the code and didn't do much, so it's gone now. Also simplified the interface of Leaf#evaluate_match, since it was now using none of the passed-in options. Finally, removed/migrated the last of the Selector/CaseStatement test/unit tests. Signed-off-by: Luke Kanies --- lib/puppet/parser/ast/casestatement.rb | 2 +- lib/puppet/parser/ast/leaf.rb | 10 +++++----- lib/puppet/parser/ast/selector.rb | 4 +--- 3 files changed, 7 insertions(+), 9 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/ast/casestatement.rb b/lib/puppet/parser/ast/casestatement.rb index 64298cac3..720ef240b 100644 --- a/lib/puppet/parser/ast/casestatement.rb +++ b/lib/puppet/parser/ast/casestatement.rb @@ -20,7 +20,7 @@ class Puppet::Parser::AST default = nil @options.each do |option| option.eachopt do |opt| - return option.safeevaluate(scope) if opt.evaluate_match(value, scope, :file => file, :line => line, :sensitive => Puppet[:casesensitive]) + return option.safeevaluate(scope) if opt.evaluate_match(value, scope) end default = option if option.default? diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb index caf1d13a5..30c4a958f 100644 --- a/lib/puppet/parser/ast/leaf.rb +++ b/lib/puppet/parser/ast/leaf.rb @@ -11,12 +11,12 @@ class Puppet::Parser::AST end # evaluate ourselves, and match - def evaluate_match(value, scope, options = {}) + def evaluate_match(value, scope) obj = self.safeevaluate(scope) - if options[:sensitive] - obj = obj.downcase if obj.respond_to?(:downcase) - value = value.downcase if value.respond_to?(:downcase) - end + + obj = obj.downcase if obj.respond_to?(:downcase) + value = value.downcase if value.respond_to?(:downcase) + # "" == undef for case/selector/if obj == value or (obj == "" and value == :undef) end diff --git a/lib/puppet/parser/ast/selector.rb b/lib/puppet/parser/ast/selector.rb index ce834b63b..d27773c4b 100644 --- a/lib/puppet/parser/ast/selector.rb +++ b/lib/puppet/parser/ast/selector.rb @@ -15,8 +15,6 @@ class Puppet::Parser::AST # Get our parameter. paramvalue = @param.safeevaluate(scope) - sensitive = Puppet[:casesensitive] - default = nil unless @values.instance_of? AST::ASTArray or @values.instance_of? Array @@ -26,7 +24,7 @@ class Puppet::Parser::AST # Then look for a match in the options. @values.each do |obj| # short circuit asap if we have a match - return obj.value.safeevaluate(scope) if obj.param.evaluate_match(paramvalue, scope, :file => file, :line => line, :sensitive => sensitive) + return obj.value.safeevaluate(scope) if obj.param.evaluate_match(paramvalue, scope) # Store the default, in case it's necessary. default = obj if obj.param.is_a?(Default) -- cgit