summaryrefslogtreecommitdiffstats
path: root/lib/facter/arp.rb
diff options
context:
space:
mode:
authorJacob Helwig <jacob@puppetlabs.com>2011-03-17 16:08:41 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-03-17 16:08:41 -0700
commit9d4f793f12961409f7fcca9e475454284bf5945c (patch)
treed9ac9b6ca936a0cd5cb121ae992e96a2652e7e03 /lib/facter/arp.rb
parent43f82efd24564862952a715cba4424d6f0c92e48 (diff)
parent330d3992744b80187223e5b6af2a58219e4610f6 (diff)
downloadfacter-9d4f793f12961409f7fcca9e475454284bf5945c.tar.gz
facter-9d4f793f12961409f7fcca9e475454284bf5945c.tar.xz
facter-9d4f793f12961409f7fcca9e475454284bf5945c.zip
Merge branch 'next'
* next: Clean up indentation, and alignment in macaddress_spec.rb (#6716) fix facter issues on OSX with ipv6 in macaddress.rb. Fixed #2346 - A much cleverer EC2 fact Fixed #2346 - Part 1: Added arp fact for Linux Discussion on ec2 facts - #2346 Fixed #3087 - Identify VMWare (#6327) Memory facts should be available on Mac Darwin Fixed #6695 - Updated id fact for Darwin et al
Diffstat (limited to 'lib/facter/arp.rb')
-rw-r--r--lib/facter/arp.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/facter/arp.rb b/lib/facter/arp.rb
new file mode 100644
index 0000000..f4b7709
--- /dev/null
+++ b/lib/facter/arp.rb
@@ -0,0 +1,22 @@
+require 'facter/util/ip'
+
+Facter.add(:arp) do
+ confine :kernel => :linux
+ setcode do
+ arp = []
+ output = %x{/usr/sbin/arp -a}
+ output.each_line do |s|
+ arp.push($1) if s =~ /^\S+\s\S+\s\S+\s(\S+)\s\S+\s\S+\s\S+$/
+ end
+ arp[0]
+ end
+end
+
+Facter::Util::IP.get_interfaces.each do |interface|
+ Facter.add("arp_" + Facter::Util::IP.alphafy(interface)) do
+ confine :kernel => :linux
+ setcode do
+ Facter::Util::IP.get_arp_value(interface)
+ end
+ end
+end