diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-23 04:49:56 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-23 04:49:56 +0000 |
| commit | 9bb5c50d0b30b4dfb82b6b705dfcbf0e126a9d61 (patch) | |
| tree | e41fbeb90e4050ea2af6d37e7b443cf9f84be162 /lib/puppet/parser/interpreter.rb | |
| parent | be711d357857f5e6d4a28a22bd60dd89e9e136c0 (diff) | |
| download | puppet-9bb5c50d0b30b4dfb82b6b705dfcbf0e126a9d61.tar.gz puppet-9bb5c50d0b30b4dfb82b6b705dfcbf0e126a9d61.tar.xz puppet-9bb5c50d0b30b4dfb82b6b705dfcbf0e126a9d61.zip | |
Not downcasing facts any longer, closing #210 (although not using the patch from mpalmer, since I had not noticed the patch was there). Also, making all nodes, classes, and definitions case insensitive, closing #344. Finally, I added case insensitivity to the language in general, which should preserve backwards compatibility and probably makes the most sense in the long run anyway.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1964 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/interpreter.rb')
| -rw-r--r-- | lib/puppet/parser/interpreter.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 5144c4970..a81b7939f 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -10,6 +10,12 @@ require 'puppet/parser/scope' class Puppet::Parser::Interpreter include Puppet::Util + + Puppet.setdefaults(:puppet, + :casesensitive => [false, + "Whether matching in case statements and selectors + should be case-sensitive. Case insensitivity is + handled by downcasing all values before comparison."]) Puppet.setdefaults("ldap", :ldapnodes => [false, @@ -239,6 +245,8 @@ class Puppet::Parser::Interpreter # The recursive method used to actually look these objects up. def fqfind(namespace, name, table) + namespace = namespace.downcase + name = name.downcase if name =~ /^::/ or namespace == "" return table[name.sub(/^::/, '')] end @@ -469,6 +477,7 @@ class Puppet::Parser::Interpreter # Create a new class, or merge with an existing class. def newclass(fqname, options = {}) + fqname = fqname.downcase if @definetable.include?(fqname) raise Puppet::ParseError, "Cannot redefine class %s as a definition" % fqname @@ -521,6 +530,7 @@ class Puppet::Parser::Interpreter # Create a new definition. def newdefine(fqname, options = {}) + fqname = fqname.downcase if @classtable.include?(fqname) raise Puppet::ParseError, "Cannot redefine class %s as a definition" % fqname @@ -551,6 +561,7 @@ class Puppet::Parser::Interpreter def newnode(names, options = {}) names = [names] unless names.instance_of?(Array) names.collect do |name| + name = name.to_s.downcase if other = @nodetable[name] @parser.error("Node %s is already defined at %s:%s; cannot redefine" % [other.name, other.file, other.line]) end @@ -585,6 +596,7 @@ class Puppet::Parser::Interpreter # Search for our node in the various locations. def nodesearch(*nodes) + nodes = nodes.collect { |n| n.to_s.downcase } # At this point, stop at the first source that defines # the node @nodesources.each do |source| |
