diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-10-24 11:25:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 11:25:56 -0700 |
commit | cd34d17fef2136fb10fda50e57a55c5afa1c703d (patch) | |
tree | ee773aecea3156e995dcda674ac29d6d897d7505 | |
parent | 8e4a6aa13f337ff6299a2f3265b803d93eedb4db (diff) | |
parent | 4dffc213c04fd2b71cc387c1e1f991ec91ef5f22 (diff) | |
download | chef-cd34d17fef2136fb10fda50e57a55c5afa1c703d.tar.gz |
Merge pull request #5483 from chef/lcg/package-inline-resources
Core: set use_inline_resources in package superclass
-rw-r--r-- | lib/chef/provider/package.rb | 12 | ||||
-rw-r--r-- | spec/unit/provider/package/windows_spec.rb | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb index 3f641145e6..3fed63c914 100644 --- a/lib/chef/provider/package.rb +++ b/lib/chef/provider/package.rb @@ -31,6 +31,8 @@ class Chef include Chef::Mixin::ShellOut extend Chef::Mixin::SubclassDirective + use_inline_resources + # subclasses declare this if they want all their arguments as arrays of packages and names subclass_directive :use_multipackage_api # subclasses declare this if they want sources (filenames) pulled from their package names @@ -81,7 +83,7 @@ class Chef end end - def action_install + action :install do unless target_version_array.any? Chef::Log.debug("#{@new_resource} is already installed - nothing to do") return @@ -116,7 +118,7 @@ class Chef private :install_description - def action_upgrade + action :upgrade do if !target_version_array.any? Chef::Log.debug("#{@new_resource} no versions to upgrade - nothing to do") return @@ -146,7 +148,7 @@ class Chef private :upgrade_description - def action_remove + action :remove do if removing_package? description = @new_resource.version ? "version #{@new_resource.version} of " : "" converge_by("remove #{description}package #{@current_resource.package_name}") do @@ -181,7 +183,7 @@ class Chef end end - def action_purge + action :purge do if removing_package? description = @new_resource.version ? "version #{@new_resource.version} of" : "" converge_by("purge #{description} package #{@current_resource.package_name}") do @@ -193,7 +195,7 @@ class Chef end end - def action_reconfig + action :reconfig do if @current_resource.version == nil Chef::Log.debug("#{@new_resource} is NOT installed - nothing to do") return diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb index d1d717bdbe..53cbbc1da1 100644 --- a/spec/unit/provider/package/windows_spec.rb +++ b/spec/unit/provider/package/windows_spec.rb @@ -26,9 +26,9 @@ describe Chef::Provider::Package::Windows, :windows_only do allow(Chef::FileCache).to receive(:create_cache_path).with("package/").and_return(cache_path) end - let(:node) { double("Chef::Node") } - let(:events) { double("Chef::Events").as_null_object } # mock all the methods - let(:run_context) { double("Chef::RunContext", :node => node, :events => events) } + let(:node) { Chef::Node.new } + let(:events) { Chef::EventDispatch::Dispatcher.new } + let(:run_context) { Chef::RunContext.new(node, {}, events) } let(:resource_source) { "calculator.msi" } let(:resource_name) { "calculator" } let(:installer_type) { nil } |