class Kitchen::Platform

A target operating system environment in which convergence integration will take place. This may represent a specific operating system, version, and machine architecture.

@author Fletcher Nichol <fnichol@nichol.ca>

Attributes

name[R]

@return [String] logical name of this platform

os_type[R]

@return [String] operating system type hint (default: `“unix”`)

shell_type[R]

@return [String] shell command flavor hint (default: `“bourne”`)

Public Class Methods

new(options = {}) click to toggle source

Constructs a new platform.

@param [Hash] options configuration for a new platform @option options [String] :name logical name of this platform

(**Required**)
# File lib/kitchen/platform.rb, line 39
def initialize(options = {})
  @name = options.fetch(:name) do
    raise ClientError, "Platform#new requires option :name"
  end
  @os_type = options.fetch(:os_type) do
    windows?(options) ? "windows" : "unix"
  end
  @shell_type = options.fetch(:shell_type) do
    windows?(options) ? "powershell" : "bourne"
  end
end

Public Instance Methods

diagnose() click to toggle source

Returns a Hash of configuration and other useful diagnostic information.

@return [Hash] a diagnostic hash

# File lib/kitchen/platform.rb, line 60
def diagnose
  { os_type: os_type, shell_type: shell_type }
end
windows?(options) click to toggle source
# File lib/kitchen/platform.rb, line 51
def windows?(options)
  @name.downcase =~ /^win/ || (
    !options[:transport].nil? && options[:transport][:name] == "winrm"
  )
end