summaryrefslogtreecommitdiff
path: root/lib/chef/provider/windows_script.rb
diff options
context:
space:
mode:
authoradamedx <adamed@opscode.com>2013-02-19 06:53:39 -0800
committeradamedx <adamed@opscode.com>2013-02-19 09:32:06 -0800
commite20d71a51bb42226571a912dfc70445d2ca10a5c (patch)
tree3114733813f33d05d331e260d58ce1f896a797ab /lib/chef/provider/windows_script.rb
parentedf49de5f28bd7c02646582f0bbe02683141b443 (diff)
downloadchef-e20d71a51bb42226571a912dfc70445d2ca10a5c.tar.gz
OC-4739: Merge functional tests, Win2k3 compatibility
Diffstat (limited to 'lib/chef/provider/windows_script.rb')
-rw-r--r--lib/chef/provider/windows_script.rb41
1 files changed, 33 insertions, 8 deletions
diff --git a/lib/chef/provider/windows_script.rb b/lib/chef/provider/windows_script.rb
index 94ffa1d3be..398e1aee6e 100644
--- a/lib/chef/provider/windows_script.rb
+++ b/lib/chef/provider/windows_script.rb
@@ -17,21 +17,50 @@
#
require 'chef/provider/script'
+require 'chef/mixin/windows_architecture_helper'
class Chef
class Provider
class WindowsScript < Chef::Provider::Script
+ protected
+
+ include Chef::Mixin::WindowsArchitectureHelper
+
def initialize( new_resource, run_context, script_extension='')
super( new_resource, run_context )
@script_extension = script_extension
+
+ target_architecture = new_resource.architecture.nil? ?
+ node_windows_architecture(run_context.node) : new_resource.architecture
+
+ @is_wow64 = wow64_architecture_override_required?(run_context.node, target_architecture)
+
+ if ( target_architecture == :i386 ) && ! is_i386_windows_process?
+ raise Chef::Exceptions::Win32ArchitectureIncorrect,
+ "Support for the i386 architecture from a 64-bit Ruby runtime is not yet implemented"
+ end
end
- def flags
- @new_resource.flags
- end
+ public
+
+ def action_run
+ wow64_redirection_state = nil
- protected
+ 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
def script_file
base_script_name = "chef-script"
@@ -39,10 +68,6 @@ class Chef
@script_file ||= Tempfile.open(temp_file_arguments)
end
-
- def interpreter_script_path
- script_file.path.gsub(::File::SEPARATOR) { | replace | ::File::ALT_SEPARATOR }
- end
end
end
end