Sha256: 5a2aa04d29551421a671b197e39e209ab5f4125d3c4a44c3290375fd71c8f3b4
Contents?: true
Size: 684 Bytes
Versions: 99
Compression:
Stored size: 684 Bytes
Contents
# Fact: hostname # # Purpose: Return the system's short hostname. # # Resolution: # On all systems but 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.execute('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
99 entries across 99 versions & 2 rubygems