Hello,
facter (1.6.13) doesn't seem to get AIX netmask correctly (example.
ifconfig -a output:
en0:
flags=1e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),LARGESEND,CHAIN>
inet 193.167.224.XXX netmask 0xffffff00 broadcast 193.167.224.255
tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
lo0:
flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN>
inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
inet6 ::1%1/0
tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1
)
facter doesn't show anything for netmask / network.
Attached patch should address this. With the patch I get:
netmask_en0 => 255.255.255.0
netmask_lo0 => 255.0.0.0
network_en0 => 193.167.224.0
network_lo0 => 127.0.0.0
-Jarno Huuskonen
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/1AFUmPFfIFMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
diff -urN facter-1.6.13.orig/lib/facter/util/ip.rb facter-1.6.13/lib/facter/util/ip.rb
--- facter-1.6.13.orig/lib/facter/util/ip.rb 2012-10-04 20:22:03.000000000 +0300
+++ facter-1.6.13/lib/facter/util/ip.rb 2012-10-15 15:22:10.195800567 +0300
@@ -23,6 +23,12 @@
:macaddress => /(?:ether|lladdr)\s+(\w?\w:\w?\w:\w?\w:\w?\w:\w?\w:\w?\w)/,
:netmask => /netmask\s+(\w{8})/
},
+ :aix => {
+ :ipaddress => /inet\s+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/,
+ :ipaddress6 => /inet6 ((?![fe80|::1])(?>[0-9,a-f,A-F]*\:{1,2})+[0-9,a-f,A-F]{0,4})/,
+ :macaddress => /(?:ether|lladdr|Hardware Address:)\s+(\w?\w:\w?\w:\w?\w:\w?\w:\w?\w:\w?\w)/,
+ :netmask => /netmask\s+(\w{10})/
+ },
:"hp-ux" => {
:ipaddress => /\s+inet (\S+)\s.*/,
:macaddress => /(\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/,
@@ -41,7 +47,7 @@
end
def self.convert_from_hex?(kernel)
- kernels_to_convert = [:sunos, :openbsd, :netbsd, :freebsd, :darwin, :"hp-ux", :"gnu/kfreebsd", :dragonfly]
+ kernels_to_convert = [:sunos, :openbsd, :netbsd, :freebsd, :darwin, :"hp-ux", :"gnu/kfreebsd", :dragonfly, :aix]
kernels_to_convert.include?(kernel)
end
@@ -75,7 +81,7 @@
case Facter.value(:kernel)
when 'Linux', 'OpenBSD', 'NetBSD', 'FreeBSD', 'Darwin', 'GNU/kFreeBSD', 'DragonFly'
output = %x{/sbin/ifconfig -a 2>/dev/null}
- when 'SunOS'
+ when 'SunOS', 'AIX'
output = %x{/usr/sbin/ifconfig -a}
when 'HP-UX'
output = %x{/bin/netstat -in | sed -e 1d}
@@ -116,7 +122,7 @@
else
output = ifconfig_output
end
- when 'SunOS'
+ when 'SunOS', 'AIX'
output = %x{/usr/sbin/ifconfig #{interface}}
when 'HP-UX'
mac = ""
@@ -193,7 +199,7 @@
if s =~ regex
value = $1
if label == 'netmask' && convert_from_hex?(kernel)
- value = value.scan(/../).collect do |byte| byte.to_i(16) end.join('.')
+ value = value.sub(/(^0x)?/,'').scan(/../).collect do |byte| byte.to_i(16) end.join('.')
end
tmp1.push(value)
end