diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-28 20:05:04 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-28 20:05:04 -0700 |
commit | bcb938da56bc522232c63c5fa4c577ec2d4b0054 (patch) | |
tree | c043b568f06cdd6d2f8b2c95623dc80d907a33cd /lib | |
parent | 883269249d175fc1bed6a445e1ccecaf0c9881c4 (diff) | |
download | chef-bcb938da56bc522232c63c5fa4c577ec2d4b0054.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')
-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 |