File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ require 'facter'
2+
3+ # Author: Francois Deppierraz <francois.deppierraz@nimag.net>
4+ # Idea and address/version mapping comes from
5+ # http://virtwo.blogspot.ch/2010/10/which-esx-version-am-i-running-on.html
6+
7+ Facter . add ( :esx_version ) do
8+ confine :virtual => :vmware
9+ setcode do
10+ if File ::executable? ( "/usr/sbin/dmidecode" )
11+ result = Facter ::Util ::Resolution . exec ( "/usr/sbin/dmidecode 2>&1" )
12+ if result
13+ bios_address = /^BIOS Information$.+?Address: (0x[0-9A-F]{5})$/m . match ( result ) [ 1 ]
14+
15+ case bios_address
16+ when '0xE8480'
17+ '2.5'
18+ when '0xE7C70'
19+ '3.0'
20+ when '0xE7910'
21+ '3.5'
22+ when '0xEA6C0'
23+ '4'
24+ when '0xEA550'
25+ '4 update 1'
26+ when '0xEA2E0'
27+ '4.1'
28+ when '0xE72C0'
29+ '5'
30+ when '0xEA0C0'
31+ '5.1'
32+ else
33+ "unknown, please report #{ bios_address } "
34+ end
35+ end
36+ end
37+ end
38+ end
You can’t perform that action at this time.
0 commit comments