Puppet Function: dns_txt
- Defined in:
- lib/puppet/parser/functions/dns_txt.rb
- Function type:
- Ruby 3.x API
Overview
Retrieves DNS TXT records and returns it as an array. Each record in the array will be a array containing the strings of the TXT record.
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/puppet/parser/functions/dns_txt.rb', line 2 newfunction(:dns_txt, :type => :rvalue, :arity => 1, :doc => <<-EOS Retrieves DNS TXT records and returns it as an array. Each record in the array will be a array containing the strings of the TXT record. EOS ) do |arguments| require 'resolv' ret = Resolv::DNS.new.getresources(arguments[0],Resolv::DNS::Resource::IN::TXT).collect do |res| res.strings end raise Resolv::ResolvError, "DNS result has no information for #{arguments[0]}" if ret.empty? ret end |