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