From: Stephen Gran Date: Tue, 21 Sep 2010 20:31:29 +0000 (+0100) Subject: Merge branch 'master' of ssh://puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5f276955049209ccc1381652d75041d21a11fea5;hp=3b3f1330f8e0e6e4869f649bffefda6d4f00c8b7;p=dsa-puppet.git Merge branch 'master' of ssh://puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet --- diff --git a/facts/ipaddresses.rb b/facts/ipaddresses.rb index eddbe66d..01e20123 100644 --- a/facts/ipaddresses.rb +++ b/facts/ipaddresses.rb @@ -19,6 +19,30 @@ Facter.add("v4ips") do end end +Facter.add("v4ips") do + confine :kernel => %w{FreeBSD} + setcode do + addrs = [] + output = %x{/sbin/ifconfig} + + output.split(/^\S/).each { |str| + if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/ + tmp = $1 + unless tmp =~ /127\./ + addrs << tmp + break + end + end + } + + ret = addrs.join(",") + if ret.empty? + ret = 'no' + end + ret + end +end + Facter.add("v6ips") do confine :kernel => :linux addrs = []