summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/resource.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/ast/resource.rb')
-rw-r--r--lib/puppet/parser/ast/resource.rb41
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb
index 802410b20..eb0bdeac4 100644
--- a/lib/puppet/parser/ast/resource.rb
+++ b/lib/puppet/parser/ast/resource.rb
@@ -18,34 +18,35 @@ class Resource < AST::ResourceReference
param.safeevaluate(scope)
}
- objtitles = @title.safeevaluate(scope)
+ resource_titles = @title.safeevaluate(scope)
# it's easier to always use an array, even for only one name
- unless objtitles.is_a?(Array)
- objtitles = [objtitles]
+ unless resource_titles.is_a?(Array)
+ resource_titles = [resource_titles]
end
- objtype = qualified_type(scope)
+ resource_type = qualified_type(scope)
+
+ # We want virtual to be true if exported is true. We can't
+ # just set :virtual => self.virtual in the initialization,
+ # because sometimes the :virtual attribute is set *after*
+ # :exported, in which case it clobbers :exported if :exported
+ # is true. Argh, this was a very tough one to track down.
+ exp = self.exported || scope.resource.exported?
+ virt = self.virtual || scope.resource.virtual? || exp
# 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.
- objtitles.flatten.collect { |objtitle|
+ resource_titles.flatten.collect { |resource_title|
exceptwrap :type => Puppet::ParseError do
- exp = self.exported || scope.resource.exported?
- # We want virtual to be true if exported is true. We can't
- # just set :virtual => self.virtual in the initialization,
- # because sometimes the :virtual attribute is set *after*
- # :exported, in which case it clobbers :exported if :exported
- # is true. Argh, this was a very tough one to track down.
- virt = self.virtual || scope.resource.virtual? || exp
- obj = Puppet::Parser::Resource.new(
- :type => objtype,
- :title => objtitle,
+ resource = Puppet::Parser::Resource.new(
+ :type => resource_type,
+ :title => resource_title,
:params => paramobjects,
:file => self.file,
:line => self.line,
- :exported => exp,
+ :exported => self.exported,
:virtual => virt,
:source => scope.source,
:scope => scope
@@ -53,11 +54,11 @@ class Resource < AST::ResourceReference
# And then store the resource in the compiler.
# At some point, we need to switch all of this to return
- # objects instead of storing them like this.
- scope.compiler.add_resource(scope, obj)
- obj
+ # resources instead of storing them like this.
+ scope.compiler.add_resource(scope, resource)
+ resource
end
- }.reject { |obj| obj.nil? }
+ }.reject { |resource| resource.nil? }
end
# Set the parameters for our object.