2 confine :kernel => :linux
4 if FileTest.exist?("/bin/ip")
5 %x{ip addr list}.each_line do |line|
6 next unless line =~ /\s+inet/
7 next if line =~ /scope (link|host)/
8 if line =~ /\s+inet\s+(\S+)\/\d{1,2} .*/
22 Facter.add("v4ips") do
23 confine :kernel => 'GNU/kFreeBSD'
26 output = %x{/sbin/ifconfig}
28 output.split(/^\S/).each { |str|
29 if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/
46 Facter.add("v6ips") do
47 confine :kernel => :linux
49 if FileTest.exist?("/bin/ip")
50 %x{ip addr list}.each_line do |line|
51 next unless line =~ /\s+inet/
52 next if line =~ /scope (link|host)/
53 if line =~ /\s+inet6\s+(\S+)\/\d{1,3} .*/