Issue #10626 has been updated by Adrien Thebo.
In lib/facter/util/manufacturer.rb we have this:
<pre>
def self.get_dmi_table()
case Facter.value(:kernel)
when 'Linux', 'GNU/kFreeBSD'
return nil unless FileTest.exists?("/usr/sbin/dmidecode")
output=%x{/usr/sbin/dmidecode 2>/dev/null}
when 'FreeBSD'
return nil unless FileTest.exists?("/usr/local/sbin/dmidecode")
output=%x{/usr/local/sbin/dmidecode 2>/dev/null}
when 'NetBSD'
return nil unless FileTest.exists?("/usr/pkg/sbin/dmidecode")
output=%x{/usr/pkg/sbin/dmidecode 2>/dev/null}
when 'SunOS'
return nil unless FileTest.exists?("/usr/sbin/smbios")
output=%x{/usr/sbin/smbios 2>/dev/null}
else
output=nil
end
return output
end
</pre>
We could break out the dmi functionality into its own utility class and reuse
it for manufacturer and virtual facts.
----------------------------------------
Bug #10626: Facter 'virtual' fact trusts path for lspci and dmidecode
https://projects.puppetlabs.com/issues/10626
Author: Mark Phillips
Status: Needs More Information
Priority: Normal
Assignee: James Turnbull
Category:
Target version:
Keywords:
Branch:
Affected Facter version:
Whilst writing a manifest today I couldn't fathom out why 'facter is_virtual'
was returning false on an ESX guest.
It turns out that 'lspci' and 'dmidecode' are listed without a path in the fact
code:
<pre>
root@mgrl002:/opt/puppet/lib/ruby/site_ruby/1.8/facter# grep -E
'lspci|dmidecode' virtual.rb
output = Facter::Util::Resolution.exec('lspci')
output = Facter::Util::Resolution.exec('dmidecode')
</pre>
...this works on the assumption that the PATH is already set correctly before
running. Yes, it works fine under normal Puppet running as a root, but I'm sure
a circumstance could arise where the PATH isn't correct. Surely it would be
better to fully qualify the binaries before running? What if root has a path
that presents a different (rogue?) tool before the proper version?
Thanks
--
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.