1 module Puppet::Parser::Functions
2 newfunction(:allnodeinfo, :type => :rvalue) do |args|
4 required = args.shift.split()
5 optional = args.shift.split()
7 allhosts = function_ldapinfo(['*', *(required+optional) ])
9 allhosts.each_pair do |hostname, host|
10 # If a returned value doesn't have all the attributes we're searching for, skip
11 # We'll skip if the array is empty, but we also seem to get back a nil object for empty attributes sometimes
12 next if required.any?{ |a| not host[a] or host[a].empty? }
18 raise Puppet::ParseError, "Error in allnodeinfo: #{e.message}\n#{e.backtrace}"
24 # vim:set shiftwidth=2: