Sha256: 44b15d76a352bcc05cb07b694ccaf9517e2769fc34ed0fde642a7b3d0123a6b1
Contents?: true
Size: 683 Bytes
Versions: 16
Compression:
Stored size: 683 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.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
16 entries across 16 versions & 1 rubygems