virtual.rb.patch
| ./facter/virtual.rb Wed May 13 10:38:02 2009 | ||
|---|---|---|
| 30 | 30 |
end |
| 31 | 31 | |
| 32 | 32 |
if result == "physical" |
| 33 |
output = Facter::Util::Resolution.exec('lspci')
|
|
| 34 |
if not output.nil? |
|
| 35 |
output.each do |p| |
|
| 36 |
# --- look for the vmware video card to determine if it is virtual => vmware. |
|
| 37 |
# --- 00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter |
|
| 38 |
result = "vmware" if p =~ /VM[wW]are/ |
|
| 39 |
end |
|
| 33 |
output = Facter::Util::Resolution.exec('vmware-checkvm')
|
|
| 34 |
if $?.exitstatus == 0 |
|
| 35 |
result = "vmware" |
|
| 40 | 36 |
else |
| 41 |
output = Facter::Util::Resolution.exec('dmidecode')
|
|
| 37 |
output = Facter::Util::Resolution.exec('lspci')
|
|
| 42 | 38 |
if not output.nil? |
| 43 |
output.each do |pd| |
|
| 44 |
result = "vmware" if pd =~ /VMware|Parallels/ |
|
| 39 |
output.each do |p| |
|
| 40 |
# --- look for the vmware video card to determine if it is virtual => vmware. |
|
| 41 |
# --- 00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter |
|
| 42 |
result = "vmware" if p =~ /VM[wW]are/ |
|
| 45 | 43 |
end |
| 46 | 44 |
else |
| 47 |
output = Facter::Util::Resolution.exec('prtdiag')
|
|
| 45 |
output = Facter::Util::Resolution.exec('dmidecode')
|
|
| 48 | 46 |
if not output.nil? |
| 49 | 47 |
output.each do |pd| |
| 50 | 48 |
result = "vmware" if pd =~ /VMware|Parallels/ |
| 51 | 49 |
end |
| 50 |
elsif Facter[:kernel].value == 'SunOS' and Facter[:kernelrelease].value == '5.10' |
|
| 51 |
# prtdiag only works on Solaris 10 x86 hosts |
|
| 52 |
output = Facter::Util::Resolution.exec('prtdiag')
|
|
| 53 |
if not output.nil? |
|
| 54 |
output.each do |pd| |
|
| 55 |
result = "vmware" if pd =~ /VMware|Parallels/ |
|
| 56 |
end |
|
| 57 |
end |
|
| 52 | 58 |
end |
| 53 | 59 |
end |
| 54 | 60 |
end |