summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/resource_override.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-10-17 09:01:04 -0500
committerLuke Kanies <luke@madstop.com>2008-10-17 09:01:04 -0500
commit8aee40de69e6fe8d67ab58a2e223443b15820584 (patch)
tree89e230df3b43302a542f2cb6869f63e2fb93f6d8 /lib/puppet/parser/ast/resource_override.rb
parent1b517d2fb048603bd1743a662bde74e8ae4b13dc (diff)
parenta74ec60d33dee1c592ec858faeccc23d7a7b79f3 (diff)
downloadpuppet-8aee40de69e6fe8d67ab58a2e223443b15820584.tar.gz
puppet-8aee40de69e6fe8d67ab58a2e223443b15820584.tar.xz
puppet-8aee40de69e6fe8d67ab58a2e223443b15820584.zip
Merge branch '0.24.x' Removed the 'after' blocks that call Type.clear,
since that method is deprecated. Conflicts: CHANGELOG bin/puppetca lib/puppet/file_serving/fileset.rb lib/puppet/network/xmlrpc/client.rb lib/puppet/type/file/selcontext.rb spec/unit/file_serving/metadata.rb spec/unit/type/file.rb
Diffstat (limited to 'lib/puppet/parser/ast/resource_override.rb')
-rw-r--r--lib/puppet/parser/ast/resource_override.rb39
1 files changed, 23 insertions, 16 deletions
diff --git a/lib/puppet/parser/ast/resource_override.rb b/lib/puppet/parser/ast/resource_override.rb
index f9464acda..8380dcd00 100644
--- a/lib/puppet/parser/ast/resource_override.rb
+++ b/lib/puppet/parser/ast/resource_override.rb
@@ -19,7 +19,7 @@ class Puppet::Parser::AST
# in the current scope.
def evaluate(scope)
# Get our object reference.
- object = @object.safeevaluate(scope)
+ resource = @object.safeevaluate(scope)
hash = {}
@@ -30,21 +30,28 @@ class Puppet::Parser::AST
# Now we just create a normal resource, but we call a very different
# method on the scope.
- obj = Puppet::Parser::Resource.new(
- :type => object.type,
- :title => object.title,
- :params => params,
- :file => @file,
- :line => @line,
- :source => scope.source,
- :scope => scope
- )
-
- # Now we tell the scope that it's an override, and it behaves as
- # necessary.
- scope.compiler.add_override(obj)
-
- obj
+ resource = [resource] unless resource.is_a?(Array)
+
+ resource = resource.collect do |r|
+ res = Puppet::Parser::Resource.new(
+ :type => r.type,
+ :title => r.title,
+ :params => params,
+ :file => @file,
+ :line => @line,
+ :source => scope.source,
+ :scope => scope
+ )
+
+ # Now we tell the scope that it's an override, and it behaves as
+ # necessary.
+ scope.compiler.add_override(res)
+
+ res
+ end
+ # decapsulate array in case of only one item
+ return resource.pop if resource.length == 1
+ return resource
end
# Create our ResourceDef. Handles type checking for us.