summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/ast')
-rw-r--r--lib/puppet/parser/ast/resource.rb5
-rw-r--r--lib/puppet/parser/ast/resource_reference.rb16
2 files changed, 4 insertions, 17 deletions
diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb
index 9149b06c3..0c58538d5 100644
--- a/lib/puppet/parser/ast/resource.rb
+++ b/lib/puppet/parser/ast/resource.rb
@@ -33,11 +33,12 @@ class Resource < AST::ResourceReference
# This is where our implicit iteration takes place; if someone
# passed an array as the name, then we act just like the called us
# many times.
- resource_type = scope.find_resource_type(type)
+ fully_qualified_type, resource_titles = scope.resolve_type_and_titles(type, resource_titles)
+
resource_titles.flatten.collect { |resource_title|
exceptwrap :type => Puppet::ParseError do
resource = Puppet::Parser::Resource.new(
- resource_type.name, resource_title,
+ fully_qualified_type, resource_title,
:parameters => paramobjects,
:file => self.file,
:line => self.line,
diff --git a/lib/puppet/parser/ast/resource_reference.rb b/lib/puppet/parser/ast/resource_reference.rb
index 5b1b0aa3a..0f8e655bf 100644
--- a/lib/puppet/parser/ast/resource_reference.rb
+++ b/lib/puppet/parser/ast/resource_reference.rb
@@ -7,23 +7,9 @@ class Puppet::Parser::AST::ResourceReference < Puppet::Parser::AST::Branch
# Evaluate our object, but just return a simple array of the type
# and name.
def evaluate(scope)
- a_type = type
titles = Array(title.safeevaluate(scope))
- case type.downcase
- when "class"
- # resolve the titles
- titles = titles.collect do |a_title|
- hostclass = scope.find_hostclass(a_title)
- hostclass ? hostclass.name : a_title
- end
- when "node"
- # no-op
- else
- # resolve the type
- resource_type = scope.find_resource_type(type)
- a_type = resource_type.name if resource_type
- end
+ a_type, titles = scope.resolve_type_and_titles(type, titles)
resources = titles.collect{ |a_title|
Puppet::Resource.new(a_type, a_title)