From 89e333a27dd5cbecd205405046bafe13d6f05563 Mon Sep 17 00:00:00 2001 From: Matt Wrock Date: Mon, 29 Feb 2016 13:25:24 -0800 Subject: fixes #4639 and returns true from define_resource_requirements for MSIs --- lib/chef/provider/package/windows.rb | 2 +- spec/unit/provider/package/windows_spec.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb index 9772a087bb..02137a5525 100644 --- a/lib/chef/provider/package/windows.rb +++ b/lib/chef/provider/package/windows.rb @@ -36,7 +36,7 @@ class Chef def define_resource_requirements requirements.assert(:install) do |a| - a.assertion { new_resource.source unless msi? } + a.assertion { new_resource.source || msi? } a.failure_message Chef::Exceptions::NoWindowsPackageSource, "Source for package #{new_resource.name} must be specified in the resource's source property for package to be installed because the package_name property is used to test for the package installation state for this package type." end end diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb index 334b258a26..e26662ac75 100644 --- a/spec/unit/provider/package/windows_spec.rb +++ b/spec/unit/provider/package/windows_spec.rb @@ -296,6 +296,15 @@ describe Chef::Provider::Package::Windows, :windows_only do it "raises a NoWindowsPackageSource error" do expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::NoWindowsPackageSource) end + + context "msi installer_type" do + let(:installer_type) { :msi } + + it "does not raise a NoWindowsPackageSource error" do + expect(provider).to receive(:install_package) + provider.run_action(:install) + end + end end context "http source given and no type given explicitly" do -- cgit v1.2.1