]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/stdlib/lib/puppet/parser/functions/parseyaml.rb
upgrade to concat 2.0.0
[dsa-puppet.git] / modules / stdlib / lib / puppet / parser / functions / parseyaml.rb
1 #
2 # parseyaml.rb
3 #
4
5 module Puppet::Parser::Functions
6   newfunction(:parseyaml, :type => :rvalue, :doc => <<-EOS
7 This function accepts YAML as a string and converts it into the correct 
8 Puppet structure.
9     EOS
10   ) do |arguments|
11
12     if (arguments.size != 1) then
13       raise(Puppet::ParseError, "parseyaml(): Wrong number of arguments "+
14         "given #{arguments.size} for 1")
15     end
16
17     require 'yaml'
18
19     YAML::load(arguments[0])
20
21   end
22 end
23
24 # vim: set ts=2 sw=2 et :