diff options
author | Luke Kanies <luke@madstop.com> | 2007-11-28 11:47:34 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-11-28 11:47:34 -0600 |
commit | c6d1746199c043c833a34393faa10d0a960f201a (patch) | |
tree | a492058ef4c018b338765399fae32336bacdd81d | |
parent | 6c1d8d3bc4f5fddf2da9d48a26fd3b851bdb7d3e (diff) | |
download | puppet-c6d1746199c043c833a34393faa10d0a960f201a.tar.gz puppet-c6d1746199c043c833a34393faa10d0a960f201a.tar.xz puppet-c6d1746199c043c833a34393faa10d0a960f201a.zip |
Fixing the first half of #917 -- the ResourcReference
AST code now correctly finds the resource. It's getting
lost in the configuration translation, though, so I
need to fix that, too.
-rw-r--r-- | lib/puppet/parser/ast/resource_reference.rb | 4 | ||||
-rwxr-xr-x | test/language/ast/resource_reference.rb | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/puppet/parser/ast/resource_reference.rb b/lib/puppet/parser/ast/resource_reference.rb index b8edff8f1..b06ea17be 100644 --- a/lib/puppet/parser/ast/resource_reference.rb +++ b/lib/puppet/parser/ast/resource_reference.rb @@ -26,8 +26,8 @@ class Puppet::Parser::AST scope = hash[:scope] title = @title.safeevaluate(:scope => scope) - if @type == "class" - objtype = @type + if @type.to_s.downcase == "class" + objtype = "class" title = qualified_class(scope, title) else objtype = qualified_type(scope) diff --git a/test/language/ast/resource_reference.rb b/test/language/ast/resource_reference.rb index d3b1ffd8f..5a18d3f45 100755 --- a/test/language/ast/resource_reference.rb +++ b/test/language/ast/resource_reference.rb @@ -39,6 +39,18 @@ class TestASTResourceReference < Test::Unit::TestCase end end + def test_finding_classes_for_reference + @parser.newclass "one" + ref = newref("Class", "one") + evaled = nil + assert_nothing_raised("Could not evaluate resource ref") do + evaled = ref.evaluate(:scope => @scope) + end + + assert_equal("class", evaled.type, "Did not set type to 'class'") + assert_equal("one", evaled.title, "Did not look up class corectly") + end + # Related to #706, make sure resource references correctly translate to qualified types. def test_scoped_references @parser.newdefine "one" |