diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-08-25 08:56:40 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-08-25 08:56:40 -0700 |
commit | 9a6c9c296896a76b7cf583f9ae6f2dd59f07b48b (patch) | |
tree | 6c36dd2a4e16528f0ad91f7aed3a359620af3d07 | |
parent | aa3f1647a7bc30708378319c71c97e4f1af2c5f4 (diff) | |
parent | 0032a23658caec281c24df179eb9c02d04fc7336 (diff) | |
download | chef-9a6c9c296896a76b7cf583f9ae6f2dd59f07b48b.tar.gz |
Merge pull request #3815 from chef/jdm/powershell-validation-fix
Fix powershell_script validation
-rw-r--r-- | lib/chef/provider/powershell_script.rb | 5 | ||||
-rw-r--r-- | spec/functional/resource/powershell_script_spec.rb | 16 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb index 004b182769..b876b6d8ee 100644 --- a/lib/chef/provider/powershell_script.rb +++ b/lib/chef/provider/powershell_script.rb @@ -99,7 +99,10 @@ EOH # Therefore, the only return value for a syntactically valid # script is 0. If an exception is raised by shellout, this # means a non-zero return and thus a syntactically invalid script. - shell_out!(validation_command, {returns: [0]}) + + with_os_architecture(node, architecture: new_resource.architecture) do + shell_out!(validation_command, {returns: [0]}) + end end end diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb index 2e8abedac5..be744e748b 100644 --- a/spec/functional/resource/powershell_script_spec.rb +++ b/spec/functional/resource/powershell_script_spec.rb @@ -227,6 +227,22 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do expect { resource.should_skip?(:run) }.to raise_error(ArgumentError, /guard_interpreter does not support blocks/) end + context "when dsc is supported", :windows_powershell_dsc_only do + it "can execute LCM configuration code" do + resource.code <<-EOF +configuration LCM +{ + param ($thumbprint) + localconfigurationmanager + { + RebootNodeIfNeeded = $false + ConfigurationMode = 'ApplyOnly' + } +} + EOF + expect { resource.run_action(:run) }.not_to raise_error + end + end end context "when running on a 32-bit version of Ruby", :ruby32_only do |