]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/stdlib/lib/puppet/parser/functions/loadyaml.rb
upgrade to concat 2.0.0
[dsa-puppet.git] / modules / stdlib / lib / puppet / parser / functions / loadyaml.rb
1 module Puppet::Parser::Functions
2
3   newfunction(:loadyaml, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
4     Load a YAML file containing an array, string, or hash, and return the data
5     in the corresponding native data type.
6
7     For example:
8
9         $myhash = loadyaml('/etc/puppet/data/myhash.yaml')
10     ENDHEREDOC
11
12     unless args.length == 1
13       raise Puppet::ParseError, ("loadyaml(): wrong number of arguments (#{args.length}; must be 1)")
14     end
15
16     YAML.load_file(args[0])
17
18   end
19
20 end