Sha256: f4ad30f44a2b966de1bb4b9e721195bd4f305590d47097fb2b2b0aff57a13c43

Contents?: true

Size: 628 Bytes

Versions: 36

Compression:

Stored size: 628 Bytes

Contents

# Fact: iphostnumber
#
# Purpose: On selected versions of Darwin, returns the host's IP address.
#
# Resolution:
#   Uses either the scutil program to get the localhost name, or parses output
#   of ifconfig for a MAC address.
#
# Caveats:
#

Facter.add(:iphostnumber) do
  confine :kernel => :darwin, :kernelrelease => "R6"
  setcode do
    %x{/usr/sbin/scutil --get LocalHostName}
  end
end
Facter.add(:iphostnumber) do
  confine :kernel => :darwin, :kernelrelease => "R6"
  setcode do
    ether = nil
    output = %x{/sbin/ifconfig}

    output =~ /HWaddr (\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/
    ether = $1

    ether
  end
end

Version data entries

36 entries across 36 versions & 3 rubygems

Version Path
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/facter-1.6.17/lib/facter/iphostnumber.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/facter-1.6.17/lib/facter/iphostnumber.rb
facter-1.6.17 lib/facter/iphostnumber.rb
facter-1.6.17.rc1 lib/facter/iphostnumber.rb
facter-1.6.16 lib/facter/iphostnumber.rb
facter-1.6.15 lib/facter/iphostnumber.rb
facter-1.6.15.rc1 lib/facter/iphostnumber.rb
facter-1.6.14 lib/facter/iphostnumber.rb
facter-1.6.14.rc1 lib/facter/iphostnumber.rb
facter-1.6.13 lib/facter/iphostnumber.rb
facter-1.6.13.rc1 lib/facter/iphostnumber.rb
facter-1.6.12 lib/facter/iphostnumber.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/facter-1.6.11/lib/facter/iphostnumber.rb
facter-1.6.12.rc2 lib/facter/iphostnumber.rb
facter-1.6.12.rc1 lib/facter/iphostnumber.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/iphostnumber.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/facter-1.6.11/lib/facter/iphostnumber.rb
facter-1.6.11 lib/facter/iphostnumber.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/iphostnumber.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/facter-1.6.4/lib/facter/iphostnumber.rb