[Pkg-puppet-devel] [facter] 56/180: (FACT-249) Support netmask fact on AIX

Stig Sandbeck Mathisen ssm at debian.org
Mon Jun 30 15:06:30 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 a2553847bbaa0e327e058246972eef0c67948eac
Author: jcitarello <jcitarello at yahoo.com>
Date:   Fri Jan 24 09:29:30 2014 -0600

    (FACT-249) Support netmask fact on AIX
---
 lib/facter/netmask.rb                         |  2 +-
 lib/facter/util/netmask.rb                    |  2 +-
 spec/fixtures/unit/netmask/ifconfig_aix_7.txt |  3 +++
 spec/unit/netmask_spec.rb                     | 11 +++++++++++
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/facter/netmask.rb b/lib/facter/netmask.rb
index 4730e5f..8195568 100644
--- a/lib/facter/netmask.rb
+++ b/lib/facter/netmask.rb
@@ -16,7 +16,7 @@
 require 'facter/util/netmask'
 
 Facter.add("netmask") do
-  confine :kernel => [ :sunos, :linux, :freebsd, :openbsd, :netbsd, :darwin, :"gnu/kfreebsd", :dragonfly ]
+  confine :kernel => [ :sunos, :linux, :freebsd, :openbsd, :netbsd, :darwin, :"gnu/kfreebsd", :dragonfly, :AIX ]
   setcode do
     Facter::NetMask.get_netmask
   end
diff --git a/lib/facter/util/netmask.rb b/lib/facter/util/netmask.rb
index 61258a9..765c2fc 100644
--- a/lib/facter/util/netmask.rb
+++ b/lib/facter/util/netmask.rb
@@ -11,7 +11,7 @@ module Facter::NetMask
         :regex => %r{#{Facter.value(:ipaddress)}.*?(?:Mask:|netmask)\s*(#{ipregex})}x,
         :munge => nil,
       }
-    when 'SunOS'
+    when 'SunOS','AIX'
       ops = {
         :ifconfig_opts => ['-a'],
         :regex => %r{\s+ inet \s #{Facter.value(:ipaddress)} \s netmask \s (\w{8})}x,
diff --git a/spec/fixtures/unit/netmask/ifconfig_aix_7.txt b/spec/fixtures/unit/netmask/ifconfig_aix_7.txt
new file mode 100644
index 0000000..4221586
--- /dev/null
+++ b/spec/fixtures/unit/netmask/ifconfig_aix_7.txt
@@ -0,0 +1,3 @@
+en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
+        inet 10.16.45.25 netmask 0xffffff00 broadcast 10.16.45.255
+         tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
diff --git a/spec/unit/netmask_spec.rb b/spec/unit/netmask_spec.rb
index c981f51..226fa11 100755
--- a/spec/unit/netmask_spec.rb
+++ b/spec/unit/netmask_spec.rb
@@ -27,6 +27,17 @@ describe "The netmask fact" do
       "ifconfig_ubuntu_1204.txt"
   end
 
+  context "on AIX" do
+    before :each do
+      Facter.fact(:kernel).stubs(:value).returns("AIX")
+    end
+
+    example_behavior_for "netmask from ifconfig output",
+      "AIX 7", "255.255.255.0",
+      "ifconfig_aix_7.txt"
+
+  end
+
   context "on Darwin" do
     before :each do
       Facter.fact(:kernel).stubs(:value).returns("Darwin")

-- 
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