summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions.rb')
-rw-r--r--lib/puppet/parser/functions.rb18
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index 6f15f7f2c..7fb19475e 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -155,22 +155,14 @@ module Functions
end.join("")
end
+ # This is just syntactic sugar for a collection, although it will generally
+ # be a good bit faster.
newfunction(:realize, :statement) do |vals|
+ coll = Puppet::Parser::Collector.new(self, :nomatter, nil, nil, :virtual)
vals = [vals] unless vals.is_a?(Array)
- vals.each do |val|
- unless val.is_a?(Puppet::Parser::Resource::Reference)
- raise Puppet::ParseError,
- "'realize' expects a resource reference; " +
- "e.g., File['/etc/passwd'], not %s" % val
- end
+ coll.resources = vals
- if resource = findresource(val.to_s)
- resource.virtual = false
- else
- raise Puppet::ParseError, "Could not find virtual resource %s" %
- val.to_s
- end
- end
+ newcollection(coll)
end
end
end