class Chef::Resource::WindowsScript

Public Class Methods

new(name, run_context, resource_name, interpreter_command) click to toggle source
Calls superclass method Chef::Resource::Script::new
# File lib/chef/resource/windows_script.rb, line 32
def initialize(name, run_context, resource_name, interpreter_command)
  super(name, run_context)
  @interpreter = interpreter_command
  @resource_name = resource_name if resource_name
  @default_guard_interpreter = self.resource_name
end

Public Instance Methods

architecture(arg = nil) click to toggle source
# File lib/chef/resource/windows_script.rb, line 43
def architecture(arg = nil)
  assert_architecture_compatible!(arg) if ! arg.nil?
  result = set_or_return(
    :architecture,
    arg,
    kind_of: Symbol
  )
end

Protected Instance Methods

assert_architecture_compatible!(desired_architecture) click to toggle source
# File lib/chef/resource/windows_script.rb, line 54
def assert_architecture_compatible!(desired_architecture)
  if desired_architecture == :i386 && Chef::Platform.windows_nano_server?
    raise Chef::Exceptions::Win32ArchitectureIncorrect,
      "cannot execute script with requested architecture 'i386' on Windows Nano Server"
  elsif ! node_supports_windows_architecture?(node, desired_architecture)
    raise Chef::Exceptions::Win32ArchitectureIncorrect,
      "cannot execute script with requested architecture '#{desired_architecture}' on a system with architecture '#{node_windows_architecture(node)}'"
  end
end