diff options
author | Luke Kanies <luke@madstop.com> | 2008-11-25 22:20:39 -0600 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-11-26 16:09:47 +1100 |
commit | 3421954444f4c06d6e7b80430f89fccf56343fe2 (patch) | |
tree | ed5d90a44a78ba25c242d5217bd795653fbec04c /lib | |
parent | a1ac9a5c14d4589f5ee7fdaab3b2c47180c66a2e (diff) | |
download | puppet-3421954444f4c06d6e7b80430f89fccf56343fe2.tar.gz puppet-3421954444f4c06d6e7b80430f89fccf56343fe2.tar.xz puppet-3421954444f4c06d6e7b80430f89fccf56343fe2.zip |
Fixing #1755 - handling fully qualified classes correctly.
This involves lexing '::class' tokens along with correctly
looking them up from the Resource::Reference class.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/lexer.rb | 2 | ||||
-rw-r--r-- | lib/puppet/parser/resource/reference.rb | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index 69a46d0c1..a7b87e6d1 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -134,7 +134,7 @@ class Puppet::Parser::Lexer '*' => :TIMES, '<<' => :LSHIFT, '>>' => :RSHIFT, - %r{([a-z][-\w]*::)+[a-z][-\w]*} => :CLASSNAME, + %r{([a-z][-\w]*)?(::[a-z][-\w]*)+} => :CLASSNAME, # Require '::' in the class name, else we'd compete with NAME %r{((::){0,1}[A-Z][-\w]*)+} => :CLASSREF ) diff --git a/lib/puppet/parser/resource/reference.rb b/lib/puppet/parser/resource/reference.rb index c59748049..cb505d606 100644 --- a/lib/puppet/parser/resource/reference.rb +++ b/lib/puppet/parser/resource/reference.rb @@ -37,7 +37,7 @@ class Puppet::Parser::Resource::Reference < Puppet::ResourceReference if self.title == :main tmp = @scope.findclass("") else - unless tmp = @scope.findclass(self.title) + unless tmp = @scope.parser.classes[self.title] fail Puppet::ParseError, "Could not find class '%s'" % self.title end end @@ -46,8 +46,9 @@ class Puppet::Parser::Resource::Reference < Puppet::ResourceReference fail Puppet::ParseError, "Could not find node '%s'" % self.title end else # normal definitions - # We have to swap these variables around so the errors are right. - tmp = @scope.finddefine(self.type) + # The resource type is capitalized, so we have to downcase. Really, + # we should have a better interface for finding these, but eh. + tmp = @scope.parser.definitions[self.type.downcase] end if tmp |