Issue #21290 has been updated by Sandip Bhattacharya.
I see that in the code on github, Facter::Util::FileRead.read_binary is now
used to read the dmi raw entry.
But this function (Facter::Util::FileRead.read_binary) doesn't have the rescue
clause of Facter::Util::FileRead.read which causes it to visibly fail in a
facter run. Can this rescue caluse be added along with trapping Errno::EINVAL,
because that is what is being thrown out in non-gce machines.
$ sudo ruby -r facter -r 'facter/util/virtual' -e 'puts
Facter::Util::Virtual.read_sysfs_dmi_entries'
/usr/share/ruby/vendor_ruby/facter/util/virtual.rb:145:in `read': Invalid
argument - /sys/firmware/dmi/entries/1-0/raw (Errno::EINVAL)
from /usr/share/ruby/vendor_ruby/facter/util/virtual.rb:145:in
`read_sysfs_dmi_entries'
from -e:1:in `<main>'
$ sudo cat /sys/firmware/dmi/entries/1-0/raw
cat: /sys/firmware/dmi/entries/1-0/raw: Invalid argument
----------------------------------------
Bug #21290: util/virtual.rb reads "/sys/firmware/dmi/entries/1-0/raw" as text
https://projects.puppetlabs.com/issues/21290#change-93234
* Author: Tom Seeley
* Status: Unreviewed
* Priority: Normal
* Assignee:
* Category:
* Target version:
* Keywords:
* Branch:
* Affected Facter version: 1.7.1
----------------------------------------
but it isn't, or at least isn't always. On a Mac mini you get this:
# cat -v "/sys/firmware/dmi/entries/1-0/raw"
^A^[/^@^A^Y^C^FB^[m^BW,M-bZM-!tM-^VM-^K6M-!$M-^H^F^E^FApple
Inc.^@Macmini5,3^@1.0^@C000000000Y7^@System SKU#^@Macmini^@^@
the net result being is_virtual throws an error:
# facter is_virtual
Could not retrieve virtual: invalid byte sequence in US-ASCII
false
Suggest someone implements the ruby equivalent of "strings" on that sysfs
value, ie:
# strings "/sys/firmware/dmi/entries/1-0/raw"
Apple Inc.
Macmini5,3
C000000000Y7
System SKU#
Macmini
My Ruby skills aren't up to the job as yet.
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.