[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5
Luke Kanies
luke at madstop.com
Wed Apr 8 21:48:06 UTC 2009
The following commit has been merged in the master branch:
commit 0e491591d2ab88938f9b127dd8c26033e817eb1a
Author: Luke Kanies <luke at madstop.com>
Date: Tue Feb 10 14:59:18 2009 -0600
Cleaning up the AST::Resource code a bit
Mostly renaming 'obj' to 'resource', since the whole
'obj' thing is a holdover from before we had the
term 'resource'.
Also pulling a bit of code out of a loop, since it
didn't need to be there.
Signed-off-by: Luke Kanies <luke at madstop.com>
diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb
index 802410b..eb0bdea 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.
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list