summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-18 06:01:18 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-18 06:01:18 +0000
commit3a6683ea720a53bd2ddb34b9215bdc676bdcdb2c (patch)
tree3865ab57a73d5b07554cda594eb9c5fff15b027a /lib/puppet/parser/functions.rb
parent05080ff50b73597f0a3f86242b63985a1e5e6003 (diff)
downloadpuppet-3a6683ea720a53bd2ddb34b9215bdc676bdcdb2c.tar.gz
puppet-3a6683ea720a53bd2ddb34b9215bdc676bdcdb2c.tar.xz
puppet-3a6683ea720a53bd2ddb34b9215bdc676bdcdb2c.zip
Changing the realize() function to be just syntactic sugar for a collection -- it literally creates a collector object now. The benefit of this is that it is late-binding, so file order does not affect whether a resource is available.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1810 980ebf18-57e1-0310-9a29-db15c13687c0
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