Puppet Function: extlib::ip_to_reverse

Defined in:
lib/puppet/functions/extlib/ip_to_reverse.rb
Function type:
Ruby 4.x API

Summary

Returns the reverse of an IP address

Overview

extlib::ip_to_reverse(Stdlib::IP::Address $ip)String

No actual query is done to the DNS server, it only calculate the record that could be added to a DNS zone file.

If you want to effectively make a query, see Vox Pupuli dns-query module: github.com/voxpupuli/puppet-dnsquery

Examples:

Calling the function

extlib::ip_to_reverse('192.0.2.0')

Parameters:

  • ip (Stdlib::IP::Address)

    IPv4 or IPv6 address

Returns:

  • (String)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/puppet/functions/extlib/ip_to_reverse.rb', line 12

Puppet::Functions.create_function(:'extlib::ip_to_reverse') do
  # @param ip
  #   IPv4 or IPv6 address
  #
  # @example Calling the function
  #   extlib::ip_to_reverse('192.0.2.0')
  dispatch :ip_to_reverse do
    param 'Stdlib::IP::Address', :ip
    return_type 'String'
  end

  def ip_to_reverse(ip)
    IPAddr.new(ip).reverse
  end
end