[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, upstream, updated. 3a39dd8353b6308cf49522990104cc63e55d7cda

Paul Nasrat pnasrat at googlemail.com
Fri Jan 29 17:22:39 UTC 2010


The following commit has been merged in the upstream branch:
commit 33be9e0f5afdd81e32f2b4654f90d86b93278744
Author: Paul Nasrat <pnasrat at googlemail.com>
Date:   Sun Aug 23 09:59:08 2009 -0500

    Add Darwin netmask support on top of Jim's patch

diff --git a/lib/facter/netmask.rb b/lib/facter/netmask.rb
index e4ddbc5..bad3648 100644
--- a/lib/facter/netmask.rb
+++ b/lib/facter/netmask.rb
@@ -9,7 +9,7 @@
 require 'facter/util/netmask'
 
 Facter.add("netmask") do
-    confine :kernel => [ :sunos, :linux, :freebsd, :openbsd, :netbsd ]
+    confine :kernel => [ :sunos, :linux, :freebsd, :openbsd, :netbsd, :darwin ]
     setcode do
         Facter::NetMask.get_netmask
     end
diff --git a/lib/facter/util/netmask.rb b/lib/facter/util/netmask.rb
index dcbb795..160cdbd 100644
--- a/lib/facter/util/netmask.rb
+++ b/lib/facter/util/netmask.rb
@@ -14,7 +14,13 @@ module Facter::NetMask
         when 'SunOS'
             ops = {
                 :ifconfig => '/usr/sbin/ifconfig -a',
-                :regex => %r{\s+ inet\s+? #{Facter.ipaddress} \+? mask (\w{8})}x,
+                :regex => %r{\s+ inet \s #{Facter.ipaddress} \s netmask \s (\w{8})}x,
+                :munge => Proc.new { |mask| mask.scan(/../).collect do |byte| byte.to_i(16) end.join('.') }
+            }
+        when 'FreeBSD','NetBSD','OpenBSD', 'Darwin'
+            ops = {
+                :ifconfig => '/sbin/ifconfig -a',
+                :regex => %r{\s+ inet \s #{Facter.ipaddress} \s netmask \s 0x(\w{8})}x,
                 :munge => Proc.new { |mask| mask.scan(/../).collect do |byte| byte.to_i(16) end.join('.') }
             }
         end

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list