Issue #12813 has been updated by Matthaus Litteken.

Status changed from Merged - Pending Release to Closed

Released in Facter 1.6.7rc1
----------------------------------------
Bug #12813: facter is now noisey on linodes due to stderr output from lspci.
https://projects.puppetlabs.com/issues/12813#change-58084

Author: Ben Hughes
Status: Closed
Priority: Normal
Assignee: 
Category: library
Target version: 1.6.7
Keywords: UX virtual
Branch: https://github.com/puppetlabs/facter/pull/177
Affected Facter version: 1.6.6


# Overview #

Due to Facter::Util::Resolution.exec just calling %x{} and not doing anything 
with STDERR (popen4!), harmless noise gets outputted.

For people who run puppet out of cron, this is tres annoying.

We run ours:
<pre>
/usr/bin/puppet agent --onetime --no-daemonize >/dev/null
</pre>

And are now getting an email per host per run.

# Expected Behaviour #

Silence.

# Actual Behaviour #

Facter outputs:

<pre>
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
</pre>

When run through puppet (or from facter), even when >/dev/null is in operation. 
lspci outputs that to stderr.


# Detail #

<https://github.com/puppetlabs/facter/blob/master/lib/facter/util/resolution.rb#L103>
 I think, doesn't cause STDERR to be caught.
<https://github.com/puppetlabs/facter/blob/master/lib/facter/virtual.rb#L96> 
calls lspci, which on nodes without PCI, such as XEN hosts, complains bitterly:

<pre>
[ben@idun:~]% lspci >/dev/null
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.

[ben@idun:~]% ls -lA /proc/bus
total 0
dr-xr-xr-x 2 root root 0 Feb 24 10:19 input

[ben@idun:~]% facter -p virtual  2>/dev/null   
physical
[ben@idun:~]% uname -a
Linux idun.puppetlabs.com 3.0.4-linode38 #1 SMP Thu Sep 22 14:59:08 EDT 2011 
i686 GNU/Linux
</pre>

# Work Around #

<pre>
[ben@enlil:facter]% git diff
diff --git i/lib/facter/virtual.rb w/lib/facter/virtual.rb
index e617359..94b10c5 100644
--- i/lib/facter/virtual.rb
+++ w/lib/facter/virtual.rb
@@ -89,7 +89,7 @@ Facter.add("virtual") do
     end
 
     if result == "physical"
-      output = Facter::Util::Resolution.exec('lspci')
+      output = Facter::Util::Resolution.exec('lspci 2>/dev/null')
       if not output.nil?
         output.each_line do |p|
           # --- look for the vmware video card to determine if it is virtual 
=> vmware.
</pre>

See #2058 for a vague discussion relating to this too.


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

Reply via email to