diff options
author | Tim Smith <tsmith@chef.io> | 2019-10-14 11:59:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-14 11:59:20 -0700 |
commit | e601e3db492368c9987a2a6e8086b1b2143a89f9 (patch) | |
tree | 42064659f8d46f06eaf777d9e16e819c828d6114 | |
parent | 431a30fa06804d793724586d03b3d92b2252d850 (diff) | |
parent | 28820c11864559c06804d1a4a94a63fd8fba7c88 (diff) | |
download | chef-e601e3db492368c9987a2a6e8086b1b2143a89f9.tar.gz |
Merge pull request #8961 from jeremyhage/fix-windows-package-path-env
Avoid a PATH environment variable update before a windows package install
-rw-r--r-- | lib/chef/provider/package/windows/exe.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/package/windows/msi.rb | 6 | ||||
-rw-r--r-- | spec/unit/provider/package/windows/exe_spec.rb | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/provider/package/windows/exe.rb b/lib/chef/provider/package/windows/exe.rb index 947f66e238..1d9656f7f8 100644 --- a/lib/chef/provider/package/windows/exe.rb +++ b/lib/chef/provider/package/windows/exe.rb @@ -64,7 +64,7 @@ class Chef unattended_flags, expand_options(new_resource.options), "& exit %%%%ERRORLEVEL%%%%", - ].join(" "), timeout: new_resource.timeout, returns: new_resource.returns, sensitive: new_resource.sensitive + ].join(" "), default_env: false, timeout: new_resource.timeout, returns: new_resource.returns, sensitive: new_resource.sensitive ) end @@ -73,7 +73,7 @@ class Chef uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) } .map(&:uninstall_string).uniq.each do |uninstall_string| logger.trace("Registry provided uninstall string for #{new_resource} is '#{uninstall_string}'") - shell_out!(uninstall_command(uninstall_string), timeout: new_resource.timeout, returns: new_resource.returns) + shell_out!(uninstall_command(uninstall_string), default_env: false, timeout: new_resource.timeout, returns: new_resource.returns) end end diff --git a/lib/chef/provider/package/windows/msi.rb b/lib/chef/provider/package/windows/msi.rb index 91b3d7a2b2..9efb8fde66 100644 --- a/lib/chef/provider/package/windows/msi.rb +++ b/lib/chef/provider/package/windows/msi.rb @@ -70,14 +70,14 @@ class Chef def install_package # We could use MsiConfigureProduct here, but we'll start off with msiexec logger.trace("#{new_resource} installing MSI package '#{new_resource.source}'") - shell_out!("msiexec /qn /i \"#{new_resource.source}\" #{expand_options(new_resource.options)}", timeout: new_resource.timeout, returns: new_resource.returns) + shell_out!("msiexec /qn /i \"#{new_resource.source}\" #{expand_options(new_resource.options)}", default_env: false, timeout: new_resource.timeout, returns: new_resource.returns) end def remove_package # We could use MsiConfigureProduct here, but we'll start off with msiexec if !new_resource.source.nil? && ::File.exist?(new_resource.source) logger.trace("#{new_resource} removing MSI package '#{new_resource.source}'") - shell_out!("msiexec /qn /x \"#{new_resource.source}\" #{expand_options(new_resource.options)}", timeout: new_resource.timeout, returns: new_resource.returns) + shell_out!("msiexec /qn /x \"#{new_resource.source}\" #{expand_options(new_resource.options)}", default_env: false, timeout: new_resource.timeout, returns: new_resource.returns) else uninstall_version = new_resource.version || installed_version uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) } @@ -86,7 +86,7 @@ class Chef uninstall_string += expand_options(new_resource.options) uninstall_string += " /q" unless uninstall_string.downcase =~ %r{ /q} logger.trace("#{new_resource} removing MSI package version using '#{uninstall_string}'") - shell_out!(uninstall_string, timeout: new_resource.timeout, returns: new_resource.returns) + shell_out!(uninstall_string, default_env: false, timeout: new_resource.timeout, returns: new_resource.returns) end end end diff --git a/spec/unit/provider/package/windows/exe_spec.rb b/spec/unit/provider/package/windows/exe_spec.rb index 6fa1747b03..6e39ddc78a 100644 --- a/spec/unit/provider/package/windows/exe_spec.rb +++ b/spec/unit/provider/package/windows/exe_spec.rb @@ -126,7 +126,7 @@ describe Chef::Provider::Package::Windows::Exe do it "removes installed package and quotes uninstall string" do new_resource.timeout = 300 allow(::File).to receive(:exist?).with("uninst_dir/uninst_file").and_return(true) - expect(provider).to receive(:shell_out!).with(%r{start \"\" /wait \"uninst_dir/uninst_file\" /S /NCRC & exit %%%%ERRORLEVEL%%%%}, timeout: 300, returns: [0]) + expect(provider).to receive(:shell_out!).with(%r{start \"\" /wait \"uninst_dir/uninst_file\" /S /NCRC & exit %%%%ERRORLEVEL%%%%}, default_env: false, timeout: 300, returns: [0]) provider.remove_package end end |