diff options
author | Claire McQuin <mcquin@users.noreply.github.com> | 2015-10-02 15:14:06 -0700 |
---|---|---|
committer | Claire McQuin <mcquin@users.noreply.github.com> | 2015-10-02 15:14:06 -0700 |
commit | 69cf21c8b35d7fb94775db377e810908e5fad54a (patch) | |
tree | c1b1df8585f8bf881c4ca4beaad0e118145298a6 /lib | |
parent | 86a62b1d54c28bf5855c76b6404452fc6ebae43c (diff) | |
parent | e444aeb53a2e031b4c8e6300b380fe26c14e203c (diff) | |
download | chef-69cf21c8b35d7fb94775db377e810908e5fad54a.tar.gz |
Merge pull request #4016 from chef/mcquin/nano-ps-script
Use -Command flag on Nano
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/provider/powershell_script.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb index b876b6d8ee..91ce11c337 100644 --- a/lib/chef/provider/powershell_script.rb +++ b/lib/chef/provider/powershell_script.rb @@ -16,6 +16,7 @@ # limitations under the License. # +require 'chef/platform/query_helpers' require 'chef/provider/windows_script' class Chef @@ -49,7 +50,10 @@ class Chef # code -- otherwise, powershell.exe does not propagate the # error status of a failed Windows process that ran at the # end of the script, it gets changed to '1'. - interpreter_flags = [default_interpreter_flags, '-File'].join(' ') + # + # Nano only supports -Command + file_or_command = Chef::Platform.windows_nano_server? ? '-Command' : '-File' + interpreter_flags = [*default_interpreter_flags, file_or_command].join(' ') if ! (@new_resource.flags.nil?) interpreter_flags = [@new_resource.flags, interpreter_flags].join(' ') @@ -107,6 +111,8 @@ EOH end def default_interpreter_flags + return [] if Chef::Platform.windows_nano_server? + # Execution policy 'Bypass' is preferable since it doesn't require # user input confirmation for files such as PowerShell modules # downloaded from the Internet. However, 'Bypass' is not supported |