Module: ChefUtils::DSL::Windows

Extended by:
Windows
Includes:
Internal
Included in:
ChefUtils, Windows
Defined in:
lib/chef-utils/dsl/windows.rb

Instance Method Summary collapse

Instance Method Details

#powershell_version(node = __getnode) ⇒ ChefUtils::VersionString

Determine the installed version of PowerShell.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

Since:

  • 15.8



79
80
81
# File 'lib/chef-utils/dsl/windows.rb', line 79

def powershell_version(node = __getnode)
  ChefUtils::VersionString.new(node["languages"]["powershell"]["version"])
end

#windows_nt_version(node = __getnode) ⇒ ChefUtils::VersionString

Determine the current Windows NT version. The NT version often differs from the marketing version, but offers a good way to find desktop and server releases that are based on the same codebase. For example NT 6.3 corresponds to Windows 8.1 and Windows 2012 R2.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

Since:

  • 15.8



68
69
70
# File 'lib/chef-utils/dsl/windows.rb', line 68

def windows_nt_version(node = __getnode)
  ChefUtils::VersionString.new(node["os_version"])
end

#windows_server?(node = __getnode) ⇒ Boolean

Determine if the current node is Windows Server.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.7



57
58
59
# File 'lib/chef-utils/dsl/windows.rb', line 57

def windows_server?(node = __getnode)
  node["kernel"]["product_type"] == "Server"
end

#windows_server_core?(node = __getnode) ⇒ Boolean

Determine if the current node is Windows Server Core.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.7



35
36
37
# File 'lib/chef-utils/dsl/windows.rb', line 35

def windows_server_core?(node = __getnode)
  node["kernel"]["server_core"] == true
end

#windows_workstation?(node = __getnode) ⇒ Boolean

Determine if the current node is Windows Workstation.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.7



46
47
48
# File 'lib/chef-utils/dsl/windows.rb', line 46

def windows_workstation?(node = __getnode)
  node["kernel"]["product_type"] == "Workstation"
end