lib/ohai/plugins/hostname.rb
def resolve_fqdn
    begin
      hostname = from_cmd("hostname")
      addrinfo = Socket.getaddrinfo(hostname, nil).first
      iaddr = IPAddr.new(addrinfo[3])
      Socket.gethostbyaddr(iaddr.hton)[0]
    rescue
      nil
    end
  end
# forward and reverse lookup to canonicalize FQDN (hostname -f equivalent)
# this is ipv6-safe, works on ruby 1.8.7+
forward and reverse lookup to canonicalize FQDN (hostname -f equivalent)
this is ipv6-safe, works on ruby 1.8.7+
forward and reverse lookup to canonicalize FQDN ( hostname - f equivalent ) this is ipv6 - safe works on ruby 1 . 8 . 7 +
def resolve_fqdn
    begin
      hostname = from_cmd("hostname")
      addrinfo = Socket.getaddrinfo(hostname, nil).first
      iaddr = IPAddr.new(addrinfo[3])
      Socket.gethostbyaddr(iaddr.hton)[0]
    rescue
      nil
    end
  end
def resolve_fqdn begin hostname = from_cmd ( "hostname" ) addrinfo = Socket . getaddrinfo ( hostname , nil ) . first iaddr = IPAddr . new ( addrinfo [ 3 ] ) Socket . gethostbyaddr ( iaddr . hton ) [ 0 ] rescue nil end end
forward and reverse lookup to canonicalize FQDN (hostname -f equivalent)
this is ipv6-safe, works on ruby 1.8.7+
forward and reverse lookup to canonicalize FQDN ( hostname - f equivalent ) this is ipv6 - safe works on ruby 1 . 8 . 7 +