Sha256: cdab709b8f54145533b72d8d1159b9d5d662f1f1137eb52e37ca8856c84365fd
Contents?: true
Size: 680 Bytes
Versions: 3
Compression:
Stored size: 680 Bytes
Contents
# Fact: hostname # # Purpose: Return the system's short hostname. # # Resolution: # On all system bar Darwin, parses the output of the "hostname" system command # to everything before the first period. # On Darwin, uses the system configuration util to get the LocalHostName # variable. # # Caveats: # Facter.add(:hostname) do setcode do hostname = nil if name = Facter::Core::Execution.exec('hostname') if name =~ /(.*?)\./ hostname = $1 else hostname = name end end hostname end end Facter.add(:hostname) do confine :kernel => :darwin, :kernelrelease => "R7" setcode '/usr/sbin/scutil --get LocalHostName' end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facter-2.0.1.rc2 | lib/facter/hostname.rb |
facter-2.0.1.rc2-x86-mingw32 | lib/facter/hostname.rb |
facter-2.0.1.rc2-universal-darwin | lib/facter/hostname.rb |