Method: Inspec::Resources::System#model

Defined in:
lib/inspec/resources/sys_info.rb

#modelObject

returns the ServerModel of the local system



102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/inspec/resources/sys_info.rb', line 102

def model
  os = inspec.os
  if os.darwin?
    inspec.command("sysctl -n hw.model").stdout.chomp
  elsif os.linux?
    inspec.command("cat /sys/class/dmi/id/product_name").stdout.chomp
  elsif os.windows?
    inspec.powershell("Get-CimInstance -ClassName Win32_ComputerSystem | Select Model -ExpandProperty Model").stdout.chomp
  else
    skip_resource "The `sys_info.model` resource is not supported on your OS yet."
  end
end