diff options
| author | Luke Kanies <luke@madstop.com> | 2009-02-11 13:51:48 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-02-11 13:51:48 -0600 |
| commit | a2270b4a4f093c6c4f171dcf0c0e05fe101dd979 (patch) | |
| tree | f0d893dfe6fe13c8c9e0670c1e5459ec336318ba /lib/puppet/parser | |
| parent | 9bac833dcfdd8d6a00188faee0487e787b7a0101 (diff) | |
| parent | 6b0c1b9170c69829bdf5956d1dec0949dcc08b35 (diff) | |
| download | puppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.tar.gz puppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.tar.xz puppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.zip | |
Merge branch '0.24.x'
Conflicts:
CHANGELOG
spec/unit/type/file/selinux.rb
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/ast/astarray.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/parser/ast/resource.rb | 40 | ||||
| -rw-r--r-- | lib/puppet/parser/collector.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/parser/functions/realize.rb | 2 |
4 files changed, 24 insertions, 24 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb index 0fccbca75..8f09aa922 100644 --- a/lib/puppet/parser/ast/astarray.rb +++ b/lib/puppet/parser/ast/astarray.rb @@ -30,9 +30,10 @@ class Puppet::Parser::AST items << child end } + rets = items.flatten.collect { |child| child.safeevaluate(scope) - }.flatten + } return rets.reject { |o| o.nil? } end diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb index 1a07fc585..d222893b3 100644 --- a/lib/puppet/parser/ast/resource.rb +++ b/lib/puppet/parser/ast/resource.rb @@ -18,34 +18,34 @@ 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. + virt = self.virtual || self.exported # 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.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 +53,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. diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb index fb7d95c52..9423db26b 100644 --- a/lib/puppet/parser/collector.rb +++ b/lib/puppet/parser/collector.rb @@ -72,8 +72,7 @@ class Puppet::Parser::Collector def collect_exported # First get everything from the export table. Just reuse our # collect_virtual method but tell it to use 'exported? for the test. - resources = collect_virtual(true).reject { |r| ! r.virtual? }.each { |r| r.exported = false } - #resources = collect_virtual(true).reject { |r| ! r.virtual? } + resources = collect_virtual(true).reject { |r| ! r.virtual? } count = resources.length diff --git a/lib/puppet/parser/functions/realize.rb b/lib/puppet/parser/functions/realize.rb index 1bdde234e..6aff19d29 100644 --- a/lib/puppet/parser/functions/realize.rb +++ b/lib/puppet/parser/functions/realize.rb @@ -8,7 +8,7 @@ Puppet::Parser::Functions::newfunction(:realize, :doc => "Make a virtual object reference; e.g.: ``realize User[luke]``." ) do |vals| coll = Puppet::Parser::Collector.new(self, :nomatter, nil, nil, :virtual) vals = [vals] unless vals.is_a?(Array) - coll.resources = vals + coll.resources = vals.flatten compiler.add_collection(coll) end |
