Chef

Chef::ShellOut::Windows is exhibiting multiple issues in 0.10.6

Details

Description

Chef::ShellOut::Windows is exhibiting multiple issues in 0.10.6:

  1. not doing smart resolution of any file with an extension in PATHEXT (ie .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW)...this causes failures in the following code (Chef::Provider::Package::Rubygems uses shell_out under the covers):
    gem_package "chef" do
      version node['omnibus']['chef-client']['version']
      gem_binary "#{embedded_dir}\\bin\\gem"
      options "-n '#{node['omnibus']['chef-client']['home']}\\bin' --no-rdoc --no-ri"
    end

    In this case "C:\opscode\chef\embedded\bin\gem" is actually "C:\opscode\chef\embedded\bin\gem.bat".

  2. .bat files are not executed correctly. From the CreatProcess API doc: To run a batch file, you must start the command interpreter; set lpApplicationName to cmd.exe and set lpCommandLine to the following arguments: /c plus the name of the batch file.
  3. STDIN/STDOUT redirection issues with certain programs (ie xcopy) when run under CreateProcess. thus the following code fails silently on the second command:
    windows_batch "unzip_and_move_ruby" do
      code <<-EOH
      "#{node['7-zip']['home']}\\7z.exe" x #{ruby_download_path} -o#{file_cache_path} -r -y
      xcopy \"#{unzip_dir_name}\" \"#{embedded_dir}\" /e /y
      EOH
      action :run
      not_if { ::File.exists?("#{embedded_dir}/bin/ruby.exe") }
    end

    The fix for this bug appears to redirect STDIN if you redirect STDOUT.

This fix should be rolled into mixlib-shellout also as the code now lives there.

Activity

Hide
Seth Chisamore added a comment - 16/Dec/11 1:44 AM
Show
Seth Chisamore added a comment - 16/Dec/11 1:44 AM This has been fixed in chef/0.10.6-rc: https://github.com/opscode/chef/commit/1033f0ba6aab441ffe13ffeb36b3c28881266344
Hide
Bryan McLellan added a comment - 16/Dec/11 3:07 AM

merged to opscode/0.10.6-rc and releasing 0.10.8

Show
Bryan McLellan added a comment - 16/Dec/11 3:07 AM merged to opscode/0.10.6-rc and releasing 0.10.8
Hide
Seth Chisamore added a comment - 16/Dec/11 4:41 AM
Show
Seth Chisamore added a comment - 16/Dec/11 4:41 AM This was also fixed in mixlib-shellout: https://github.com/opscode/mixlib-shellout/commit/cc948ed6f39229032a9aa2d26c77c5379b373e58

People

Vote (0)
Watch (0)

Dates

  • Created:
    15/Dec/11 11:42 PM
    Updated:
    16/Dec/11 4:41 AM
    Resolved:
    16/Dec/11 1:44 AM