Issue #10278 has been updated by Ken Barber.
Status changed from Accepted to Needs More Information
Bernhard, I'm unable to replicate your ipaddress/macaddress failure myself.
I've tried master, and even went back to version 1.6.0 and version 1.6.2 to see
if I could replicate it:
[root@localhost facter]# pwd
/root/Development/facter
[root@localhost facter]# git status
# On branch master
nothing to commit (working directory clean)
[root@localhost facter]# export RUBYLIB=./lib
[root@localhost facter]# ./bin/facter | grep ipaddress
ipaddress => 192.168.182.158
ipaddress_eth0 => 192.168.182.158
ipaddress_lo => 127.0.0.1
[root@localhost facter]# ./bin/facter | grep macaddress
macaddress => 00:0C:29:08:95:C5
macaddress_eth0 => 00:0C:29:08:95:C5
[root@localhost facter]# echo $LANG
de_DE.UTF-8
[root@localhost facter]# git checkout 1.6.0
Note: checking out '1.6.0'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 23bb324... Readying for release of 1.6.0
[root@localhost facter]# ./bin/facter | grep macaddress
macaddress => 00:0C:29:08:95:C5
macaddress_eth0 => 00:0C:29:08:95:C5
[root@localhost facter]# ./bin/facter | grep ipaddress
ipaddress => 192.168.182.158
ipaddress_eth0 => 192.168.182.158
ipaddress_lo => 127.0.0.1
[root@localhost facter]#
I did this test on a German installed Centos 6.0 using Ruby 1.8.7. Can you give
me more details of the exact platform this was occurring on? Or any other
pointers on how to replicate this?
----------------------------------------
Bug #10278: some facts do not work with locales set
https://projects.puppetlabs.com/issues/10278
Author: Bernhard Schmidt
Status: Needs More Information
Priority: Normal
Assignee:
Category: interface
Target version: 1.6.x
Keywords: locale
Branch:
Affected Facter version: 1.6.2
facter does not clean locale environment variables prior to executing commands
and sometimes falls over the localized output. I'm not sure whether this is
relevant for facter being executed by puppet, but it makes debugging a lot
harder. For example with the macaddress fact
<pre>
root@mail:~# facter | grep mac
Could not retrieve macaddress: undefined method `split' for nil:NilClass
Could not retrieve macaddress: undefined method `split' for nil:NilClass
root@mail:~# LANG=C LC_ALL=C facter | grep mac
macaddress => 52:54:00:94:f3:1c
macaddress_eth0 => 52:54:00:94:f3:1c
</pre>
The reason is that macaddress.rb is looking for ether or HWaddr
<pre>
setcode do
ether = []
output = Facter::Util::Resolution.exec("/sbin/ifconfig -a")
output.each_line do |s|
ether.push($1) if s =~ /(?:ether|HWaddr)
(\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2}:\w{1,2})/
end
Facter::Util::Macaddress.standardize(ether[0])
</pre>
which is not contained in the localized output
<pre>
root@mail:~# ifconfig -a
eth0 Link encap:Ethernet Hardware Adresse 52:54:00:94:f3:1c
inet Adresse:80.244.243.68 Bcast:80.244.243.71 Maske:255.255.255.248
inet6-Adresse: 2001:4d88:1005::25:1:2/64 Gültigkeitsbereich:Global
inet6-Adresse: fe80::5054:ff:fe94:f31c/64
Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1
RX packets:4018239 errors:0 dropped:0 overruns:0 frame:0
TX packets:790814 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX bytes:658542927 (628.0 MiB) TX bytes:162143875 (154.6 MiB)
</pre>
The full difference between a LANG=de_DE and LANG=C run on the same machine:
<pre>
--- /tmp/facter.DE 2011-10-25 22:17:13.568013673 +0200
+++ /tmp/facter.C 2011-10-25 22:17:19.504013672 +0200
@@ -8,7 +8,11 @@
hostname => mail
id => root
interfaces => eth0,lo
-ipaddress => 80.244.243.71
+ipaddress => 80.244.243.68
+ipaddress6 => 2001:4d88:1005::25:1:2
+ipaddress6_eth0 => 2001:4d88:1005::25:1:2
+ipaddress_eth0 => 80.244.243.68
+ipaddress_lo => 127.0.0.1
is_virtual => true
kernel => Linux
kernelmajversion => 3.0
@@ -19,9 +23,16 @@
lsbdistid => Debian
lsbdistrelease => testing
lsbmajdistrelease => testing
+macaddress => 52:54:00:94:f3:1c
+macaddress_eth0 => 52:54:00:94:f3:1c
manufacturer => Bochs
-memoryfree => 345.66 MB
+memoryfree => 348.94 MB
memorysize => 749.06 MB
+netmask => 255.255.255.248
+netmask_eth0 => 255.255.255.248
+netmask_lo => 255.0.0.0
+network_eth0 => 80.244.243.64
+network_lo => 127.0.0.0
operatingsystem => Debian
operatingsystemrelease => wheezy/sid
osfamily => Debian
@@ -45,5 +56,5 @@
uptime => 1 day
uptime_days => 1
uptime_hours => 29
-uptime_seconds => 107884
+uptime_seconds => 107890
virtual => kvm
</pre>
uptime_seconds and memory_* has to be ignored here of course.
facter should probably reset LANG/LC* variables or even better use a sane API,
for example /sys/class/net/ethx/address on platforms where it is supported
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
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-bugs?hl=en.