hostname.rb

Path: lib/ohai/plugins/hostname.rb
Last Update: Sat Feb 23 07:12:37 +0000 2019
Author:Adam Jacob (<adam@opscode.com>)
Author:Benjamin Black (<nostromo@gmail.com>)
Author:Bryan McLellan (<btm@loftninjas.org>)
Author:Daniel DeLeo (<dan@kallistec.com>)
Author:Doug MacEachern (<dougm@vmware.com>)
Author:James Gartrell (<jgartrel@gmail.com>)
Copyright:Copyright (c) 2008, 2009 Opscode, Inc.
Copyright:Copyright (c) 2009 Bryan McLellan
Copyright:Copyright (c) 2009 Daniel DeLeo
Copyright:Copyright (c) 2010 VMware, Inc.
License:Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Required files

socket   ipaddr   sigar   sigar   wmi-lite/wmi   socket  

Methods

Public Instance methods

hostname : short hostname machinename : output of hostname command (might be short on solaris) fqdn : result of canonicalizing hostname using DNS or /etc/hosts domain : domain part of FQDN

hostname and machinename should always exist fqdn and domain may be broken if DNS is broken on the host

forward and reverse lookup to canonicalize FQDN (hostname -f equivalent) this is ipv6-safe, works on ruby 1.8.7+

[Validate]