class Chef::Provider::WindowsScript

Attributes

is_forced_32bit[R]

Public Class Methods

new( new_resource, run_context, script_extension = "") click to toggle source
Calls superclass method Chef::Provider::Script::new
# File lib/chef/provider/windows_script.rb, line 32
def initialize( new_resource, run_context, script_extension = "")
  super( new_resource, run_context )
  @script_extension = script_extension

  target_architecture = if new_resource.architecture.nil?
                          node_windows_architecture(run_context.node)
                        else
                          new_resource.architecture
                        end

  @is_wow64 = wow64_architecture_override_required?(run_context.node, target_architecture)

  @is_forced_32bit = forced_32bit_override_required?(run_context.node, target_architecture)
end

Public Instance Methods

action_run() click to toggle source
Calls superclass method Chef::Provider::Script#action_run
# File lib/chef/provider/windows_script.rb, line 49
def action_run
  wow64_redirection_state = nil

  if @is_wow64
    wow64_redirection_state = disable_wow64_file_redirection(@run_context.node)
  end

  begin
    super
  rescue
    raise
  ensure
    if ! wow64_redirection_state.nil?
      restore_wow64_file_redirection(@run_context.node, wow64_redirection_state)
    end
  end
end
script_file() click to toggle source
# File lib/chef/provider/windows_script.rb, line 67
def script_file
  base_script_name = "chef-script"
  temp_file_arguments = [ base_script_name, @script_extension ]

  @script_file ||= Tempfile.open(temp_file_arguments)
end