Class: Inspec::Resources::System

Inherits:
Object
  • Object
show all
Defined in:
lib/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



17
18
19
20
21
22
23
24
25
26
# File 'lib/resources/sys_info.rb', line 17

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