diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-28 20:05:04 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-31 12:37:41 -0700 |
commit | 2a4ae0725a67bf974005a3a56d7d27f101647a00 (patch) | |
tree | 9865d8d6a6d93fe9f7712f5d959b92aacfa16816 /lib/chef/resource | |
parent | b10c5af41301481338c37c4e046b8cae31e633da (diff) | |
download | chef-2a4ae0725a67bf974005a3a56d7d27f101647a00.tar.gz |
Better detect currently installed packages
Pulls in https://github.com/chef-boneyard/dmg/pull/24 which avoids the current regex like method and instead requires an exact match.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource')
-rw-r--r-- | lib/chef/resource/dmg_package.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource/dmg_package.rb b/lib/chef/resource/dmg_package.rb index 5387f8af68..d721f64ba9 100644 --- a/lib/chef/resource/dmg_package.rb +++ b/lib/chef/resource/dmg_package.rb @@ -81,9 +81,9 @@ 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\"" - 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}'\"" + Chef::Log.info "#{new_resource.app} is already installed. To upgrade, remove \"#{new_resource.destination}/#{new_resource.app}.app\"" + elsif shell_out("pkgutil --pkg-info '#{new_resource.package_id}'").exitstatus == 0 + Chef::Log.info "#{new_resource.app} is already installed. To upgrade, try \"sudo pkgutil --forget '#{new_resource.package_id}'\"" else current_value_does_not_exist! # allows us to check for current_resource.nil? below end |