diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-18 04:45:55 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-18 04:45:55 +0000 |
| commit | a05b8f5116af3a4908d5aed2a6a320b227609ec7 (patch) | |
| tree | 74eb2ac2000b21d0eb474272575dde415dcf863f /lib/puppet/parser/functions.rb | |
| parent | 8a4bf1bd9d5ed674c0eed2c64d8a5f587452ede2 (diff) | |
| download | puppet-a05b8f5116af3a4908d5aed2a6a320b227609ec7.tar.gz puppet-a05b8f5116af3a4908d5aed2a6a320b227609ec7.tar.xz puppet-a05b8f5116af3a4908d5aed2a6a320b227609ec7.zip | |
Adding a "realize" function that can be used to make one or more resource non-virtual. It is just syntactic sugar for a collection by title.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1808 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/functions.rb')
| -rw-r--r-- | lib/puppet/parser/functions.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb index 75d1c9a31..6f15f7f2c 100644 --- a/lib/puppet/parser/functions.rb +++ b/lib/puppet/parser/functions.rb @@ -154,6 +154,24 @@ module Functions end end.join("") end + + newfunction(:realize, :statement) do |vals| + 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 + + if resource = findresource(val.to_s) + resource.virtual = false + else + raise Puppet::ParseError, "Could not find virtual resource %s" % + val.to_s + end + end + end end end |
