summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-25 22:20:39 -0600
committerJames Turnbull <james@lovedthanlost.net>2008-11-26 16:09:47 +1100
commit3421954444f4c06d6e7b80430f89fccf56343fe2 (patch)
treeed5d90a44a78ba25c242d5217bd795653fbec04c /lib
parenta1ac9a5c14d4589f5ee7fdaab3b2c47180c66a2e (diff)
downloadpuppet-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.rb2
-rw-r--r--lib/puppet/parser/resource/reference.rb7
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