Please review pull request #106: Fix arp module for EC2 opened by (pieterlexis)

Description:

See http://projects.puppetlabs.com/issues/11196

  • When there is more than one entry in the arp table, and the gateway isn't the first. No ec2 facts are created. This commit fixed this at the expense of more memory usage.

  • Opened: Tue Dec 06 14:12:36 UTC 2011
  • Based on: puppetlabs:master (0f9a595c7224a0b5566262647914f52c5c879447)
  • Requested merge: pieterlexis:ec2_multiple_interfaces (a2e984bbf6be9566e848308a0d3ab35d8bffcdf5)

Diff follows:

diff --git a/lib/facter/arp.rb b/lib/facter/arp.rb
index 2c8bde5..019ada6 100644
--- a/lib/facter/arp.rb
+++ b/lib/facter/arp.rb
@@ -5,15 +5,14 @@
   setcode do
     output = Facter::Util::Resolution.exec('arp -an')
     if not output.nil?
-      arp = ""
+      arp = []
       output.each_line do |s|
         if s =~ /^\S+\s\S+\s\S+\s(\S+)\s\S+\s\S+\s\S+$/
-          arp = $1.downcase
-          break # stops on the first match
+          arp << $1.downcase
         end
       end
     end
-    "fe:ff:ff:ff:ff:ff" == arp ? arp : nil
+    arp.contains?("fe:ff:ff:ff:ff:ff") ? "fe:ff:ff:ff:ff:ff" : nil
   end
 end
 

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to