File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ require 'facter'
2+
3+ # Author: Francois Deppierraz <[email protected] > 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+ begin
14+ bios_address = /^BIOS Information$.+?Address: (0x[0-9A-F]{5})$/m . match ( result ) [ 1 ]
15+
16+ case bios_address
17+ when '0xE8480'
18+ '2.5'
19+ when '0xE7C70'
20+ '3.0'
21+ when '0xE7910'
22+ '3.5'
23+ when '0xEA6C0'
24+ '4'
25+ when '0xEA550'
26+ '4 update 1'
27+ when '0xEA2E0'
28+ '4.1'
29+ when '0xE72C0'
30+ '5'
31+ when '0xEA0C0'
32+ '5.1'
33+ else
34+ "unknown, please report #{ bios_address } "
35+ end
36+ rescue
37+ 'n/a'
38+ end
39+ end
40+ end
41+ end
42+ end
You can’t perform that action at this time.
0 commit comments