Class: Inspec::Resources::System

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/resources/sys_info.rb

Overview

this resource returns additional system informatio

Instance Method Summary collapse

Instance Method Details

#hostnameObject

returns the hostname of the local system



19
20
21
22
23
24
25
26
27
28
# File 'lib/inspec/resources/sys_info.rb', line 19

def hostname
  os = inspec.os
  if os.linux? || os.darwin?
    inspec.command("hostname").stdout.chomp
  elsif os.windows?
    inspec.powershell("$env:computername").stdout.chomp
  else
    skip_resource "The `sys_info.hostname` resource is not supported on your OS yet."
  end
end