change from dmidecode to /sys/class/dmi/id/*

(kudos to Seife)

Signed-off-by: Eike Waldt <waldt@b1-systems.de>
This commit is contained in:
Eike Waldt 2019-07-16 21:14:39 +02:00
parent 9fa97e8baa
commit b47cf6e80e
No known key found for this signature in database
GPG key ID: D1E0FBB747DCAE4B
2 changed files with 4 additions and 4 deletions

View file

@ -33,7 +33,7 @@ module Inspec::Resources
if os.darwin? if os.darwin?
"Apple Inc." "Apple Inc."
elsif os.linux? elsif os.linux?
inspec.command("dmidecode | grep 'Vendor :'").split(": ").last.chomp inspec.command("cat /sys/class/dmi/id/sys_vendor").stdout.chomp
elsif os.windows? elsif os.windows?
inspec.powershell("Get-CimInstance -ClassName Win32_ComputerSystem | Select Manufacturer -ExpandProperty Manufacturer").stdout.chomp inspec.powershell("Get-CimInstance -ClassName Win32_ComputerSystem | Select Manufacturer -ExpandProperty Manufacturer").stdout.chomp
else else
@ -47,7 +47,7 @@ module Inspec::Resources
if os.darwin? if os.darwin?
inspec.command("system_profiler SPHardwareDataType | grep 'Model Identifier:'").split(": ").last.chomp inspec.command("system_profiler SPHardwareDataType | grep 'Model Identifier:'").split(": ").last.chomp
elsif os.linux? elsif os.linux?
inspec.command("dmidecode | grep 'Product Name: '").split(": ").last.chomp inspec.command("cat /sys/class/dmi/id/product_name").stdout.chomp
elsif os.windows? elsif os.windows?
inspec.powershell("Get-CimInstance -ClassName Win32_ComputerSystem | Select Model -ExpandProperty Model").stdout.chomp inspec.powershell("Get-CimInstance -ClassName Win32_ComputerSystem | Select Model -ExpandProperty Model").stdout.chomp
else else

View file

@ -370,11 +370,11 @@ class MockLoader
# hostname windows # hostname windows
"$env:computername" => cmd.call("$env-computername"), "$env:computername" => cmd.call("$env-computername"),
# Manufacturer linux # Manufacturer linux
"dmidecode | grep 'Vendor: '" => cmd.call("manufacturer"), "cat /sys/class/dmi/id/sys_vendor" => cmd.call("manufacturer"),
# Manufacturer windows # Manufacturer windows
"Get-CimInstance -ClassName Win32_ComputerSystem | Select Manufacturer -ExpandProperty Manufacturer" => cmd.call("manufacturer"), "Get-CimInstance -ClassName Win32_ComputerSystem | Select Manufacturer -ExpandProperty Manufacturer" => cmd.call("manufacturer"),
# Model linux # Model linux
"dmidecode | grep 'Product Name: '" => cmd.call("model"), "cat /sys/class/dmi/id/product_name" => cmd.call("model"),
# Model windows # Model windows
"Get-CimInstance -ClassName Win32_ComputerSystem | Select Model -ExpandProperty Model" => cmd.call("model"), "Get-CimInstance -ClassName Win32_ComputerSystem | Select Model -ExpandProperty Model" => cmd.call("model"),
# windows_hotfix windows # windows_hotfix windows