]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/puppetmaster/lib/puppet/parser/functions/getfromhash.rb
Try returning an info hash for a hoster - this will fail
[dsa-puppet.git] / modules / puppetmaster / lib / puppet / parser / functions / getfromhash.rb
1 module Puppet::Parser::Functions
2   newfunction(:getfromhash, :type => :rvalue) do |args|
3     h = args.shift
4     key = args.shift
5
6     raise Puppet::ParseError, "argument is not a hash" unless h.kind_of?(Hash)
7     if h.has_key?(key)
8       ans = h[key]
9     else
10       ans = false
11     end
12
13     return ans
14   end
15 end
16 # vim:set et:
17 # vim:set sts=2 ts=2:
18 # vim:set shiftwidth=2: