Merge pull request #205 from jeffweiss/ticket/master/12147_remove_iphostnumber_fact
(#12147) Remove Darwin 6-specific iphostnumber fact
Daniel Pittman
12 years ago
0 | # Fact: iphostnumber | |
1 | # | |
2 | # Purpose: On selected versions of Darwin, returns the host's IP address. | |
3 | # | |
4 | # Resolution: | |
5 | # Uses either the scutil program to get the localhost name, or parses output | |
6 | # of ifconfig for a MAC address. | |
7 | # | |
8 | # Caveats: | |
9 | # | |
10 | ||
11 | Facter.add(:iphostnumber) do | |
12 | confine :kernel => :darwin, :kernelrelease => "R6" | |
13 | setcode do | |
14 | %x{/usr/sbin/scutil --get LocalHostName} | |
15 | end | |
16 | end | |
17 | Facter.add(:iphostnumber) do | |
18 | confine :kernel => :darwin, :kernelrelease => "R6" | |
19 | setcode do | |
20 | ether = nil | |
21 | output = %x{/sbin/ifconfig} | |
22 | ||
23 | output =~ /HWaddr (\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ | |
24 | ether = $1 | |
25 | ||
26 | ether | |
27 | end | |
28 | end |