[Pkg-puppet-devel] [facter] 65/180: (FACT-459) Fix MTU interface facts not being reported for Archlinux.

Stig Sandbeck Mathisen ssm at debian.org
Mon Jun 30 15:06:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit 4199e6b087a6855dfca0825d031932a35963a752
Author: Peter Huene <peter.huene at puppetlabs.com>
Date:   Wed Apr 23 16:42:38 2014 -0700

    (FACT-459) Fix MTU interface facts not being reported for Archlinux.
    
    The regular expression being used assumes that MTU is uppercase and
    followed by a colon. On Archlinux, ifconfig (net-tools 1.60+) reports
    a lowercase "mtu" followed by a space.
---
 lib/facter/util/ip.rb        |  2 +-
 spec/unit/interfaces_spec.rb | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/facter/util/ip.rb b/lib/facter/util/ip.rb
index 81bb706..5431cf7 100644
--- a/lib/facter/util/ip.rb
+++ b/lib/facter/util/ip.rb
@@ -9,7 +9,7 @@ module Facter::Util::IP
       :ipaddress6 => /inet6 (?:addr: )?((?![fe80|::1])(?>[0-9,a-f,A-F]*\:{1,2})+[0-9,a-f,A-F]{0,4})/,
       :macaddress => /(?:ether|HWaddr)\s+((\w{1,2}:){5,}\w{1,2})/,
       :netmask  => /(?:Mask:|netmask )([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/,
-      :mtu  => /MTU:(\d+)/
+      :mtu  => /MTU:?\s*(\d+)/i
     },
     :bsd   => {
       :aliases  => [:openbsd, :netbsd, :freebsd, :darwin, :"gnu/kfreebsd", :dragonfly],
diff --git a/spec/unit/interfaces_spec.rb b/spec/unit/interfaces_spec.rb
index 1b244c5..cfe78c2 100755
--- a/spec/unit/interfaces_spec.rb
+++ b/spec/unit/interfaces_spec.rb
@@ -4,15 +4,15 @@ require 'spec_helper'
 require 'shared_formats/parses'
 require 'facter/util/ip'
 
-shared_examples_for "netmask_* from ifconfig output" do |platform, interface, address, fixture|
-  it "correctly on #{platform} interface #{interface}" do
+shared_examples_for "interface netmask and mtu from ifconfig output" do |platform, interface, netmask, mtu, fixture|
+  it "should be correct on #{platform} for interface #{interface}" do
     Facter::Util::IP.stubs(:exec_ifconfig).returns(my_fixture_read(fixture))
     Facter::Util::IP.stubs(:get_output_for_interface_and_label).
       returns(my_fixture_read("#{fixture}.#{interface}"))
     Facter.collection.internal_loader.load(:interfaces)
 
-    fact = Facter.fact("netmask_#{interface}".intern)
-    fact.value.should eq(address)
+    Facter.fact("netmask_#{interface}".intern).value.should eq(netmask)
+    Facter.fact("mtu_#{interface}".intern).value.should eq(mtu)
   end
 end
 
@@ -43,15 +43,15 @@ describe "Per Interface IP facts" do
   end
 end
 
-describe "Netmask handling on Linux" do
+describe "Netmask and MTU handling on Linux" do
   before :each do
     Facter.fact(:kernel).stubs(:value).returns("Linux")
   end
 
-  example_behavior_for "netmask_* from ifconfig output",
+  example_behavior_for "interface netmask and mtu from ifconfig output",
     "Archlinux (net-tools 1.60)", "em1",
-    "255.255.255.0", "ifconfig_net_tools_1.60.txt"
-  example_behavior_for "netmask_* from ifconfig output",
+    "255.255.255.0", "1500", "ifconfig_net_tools_1.60.txt"
+  example_behavior_for "interface netmask and mtu from ifconfig output",
     "Archlinux (net-tools 1.60)", "lo",
-    "255.0.0.0", "ifconfig_net_tools_1.60.txt"
+    "255.0.0.0", "16436", "ifconfig_net_tools_1.60.txt"
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list