This repository has been archived by the owner. It is now read-only.
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (15 sloc) 483 Bytes
module Puppet::Parser::Functions
newfunction(:parse_userdata, :type => :rvalue) do |args|
unless args.length == 0
raise Puppet::ParseError, "parse_userdata(): Requires no arguments"
end
begin
userdata = lookupvar('ec2_userdata')
hash = PSON.load(userdata)
rescue
Puppet.warning("parse_userdata(): Unable to parse JSON from ec2_userdata")
hash = {}
end
hash
end
end