diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-27 18:19:00 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-31 12:36:54 -0700 |
commit | 00d47ffef7fca35798515c1bbc3bb9381fc5c2a6 (patch) | |
tree | 15d26350615ea869b699d771f4d4591f3d2b2a82 /lib/chef | |
parent | 36b8f51ad6a745647a999c6ec5d5ebd721c11c6b (diff) | |
download | chef-00d47ffef7fca35798515c1bbc3bb9381fc5c2a6.tar.gz |
Use current_value instead of the installed property
Remove the need for tracking state in the installed property
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/resource/dmg_package.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/chef/resource/dmg_package.rb b/lib/chef/resource/dmg_package.rb index f697d8303b..6d8a90e007 100644 --- a/lib/chef/resource/dmg_package.rb +++ b/lib/chef/resource/dmg_package.rb @@ -57,9 +57,6 @@ class Chef equal_to: %w{app pkg mpkg}, default: "app" - property :installed, [TrueClass, FalseClass], - default: false, desired_state: false - property :package_id, String, description: "The package id registered with pkgutil when a pkg or mpkg is installed" @@ -81,20 +78,17 @@ class Chef load_current_value do |new_resource| if ::File.directory?("#{new_resource.destination}/#{new_resource.app}.app") Chef::Log.info "Already installed; to upgrade, remove \"#{new_resource.destination}/#{new_resource.app}.app\"" - installed true elsif shell_out("pkgutil --pkgs='#{new_resource.package_id}'").exitstatus == 0 Chef::Log.info "Already installed; to upgrade, try \"sudo pkgutil --forget '#{new_resource.package_id}'\"" - installed true else - installed false + current_value_does_not_exist! # allows us to check for current_resource.nil? below end end action :install do description "Installs the application." - unless current_resource.installed - + if current_resource.nil? volumes_dir = new_resource.volumes_dir ? new_resource.volumes_dir : new_resource.app dmg_name = new_resource.dmg_name ? new_resource.dmg_name : new_resource.app |