Module Facter::Util::IP
In: lib/facter/util/ip.rb

A base module for collecting IP-related information from all kinds of platforms.

Methods

Classes and Modules

Class Facter::Util::IP::Windows

Constants

REGEX_MAP = { :linux => { :ipaddress => /inet (?:addr:)?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/, :ipaddress6 => /inet6 (?:addr: )?((?!(?:fe80|::1))(?>[0-9,a-f,A-F]*\:{1,2})+[0-9,a-f,A-F]{0,4})/, :macaddress => /(?:ether|HWaddr)\s+((\w{1,2}:){5,}\w{1,2})/, :netmask => /(?:Mask:|netmask )([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/, :mtu => /MTU:?\s*(\d+)/i   A map of all the different regexes that work for a given platform or set of platforms.

Public Class methods

Convert an interface name into purely alphanumeric characters.

exec_ifconfig uses the ifconfig command

@return [String] the output of `ifconfig #{arguments} 2>/dev/null` or nil

exec_netstat uses the netstat command

@return [String] the output of `netstat #{arguments} 2>/dev/null` or nil

get_ifconfig looks up the ifconfig binary

@return [String] path to the ifconfig binary

get_interface_value obtains the value of a specific attribute of a specific interface.

@param interface [String] the interface identifier, e.g. "eth0" or "bond0"

@param label [String] the attribute of the interface to obtain a value for, e.g. "netmask" or "ipaddress"

@api private

@return [String] representing the requested value. An empty array is returned if the kernel is not supported by the REGEX_MAP constant.

get_netstat looks up the netstat binary

@return [String] path to the netstat binary

hpux_netstat_in is a delegate method that allows us to stub netstat -in without stubbing exec.

[Validate]