diff options
author | Tim Smith <tsmith@chef.io> | 2021-01-04 13:57:55 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 13:57:55 -0800 |
commit | ccf12f8172409560857f60a4b9c4848860f35550 (patch) | |
tree | 6ab58e093593c979e8d0bd7532e374bc0b05a85c | |
parent | 95ea3116cc2642e00800ce68fdfc0cb96c7b3b3c (diff) | |
parent | 73f5d87f6d1a6c2e9ca519029a70a722520d6905 (diff) | |
download | chef-ccf12f8172409560857f60a4b9c4848860f35550.tar.gz |
Merge pull request #10822 from chef/fix_cask
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | kitchen-tests/cookbooks/end_to_end/recipes/macos.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/homebrew_cask.rb | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb b/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb index 5f2278538b..d6a3b40bf8 100644 --- a/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb +++ b/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb @@ -83,6 +83,8 @@ homebrew_package "nethack" do action :purge end +homebrew_cask "do-not-disturb" + include_recipe "::_dmg_package" include_recipe "::_macos_userdefaults" include_recipe "::_ohai_hint" diff --git a/lib/chef/resource/homebrew_cask.rb b/lib/chef/resource/homebrew_cask.rb index 3b0974348c..4c68afaab0 100644 --- a/lib/chef/resource/homebrew_cask.rb +++ b/lib/chef/resource/homebrew_cask.rb @@ -60,7 +60,7 @@ class Chef unless casked? converge_by("install cask #{new_resource.cask_name} #{new_resource.options}") do - shell_out!("#{new_resource.homebrew_path} cask install #{new_resource.cask_name} #{new_resource.options}", + shell_out!("#{new_resource.homebrew_path} install --cask #{new_resource.cask_name} #{new_resource.options}", user: new_resource.owner, env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner }, cwd: ::Dir.home(new_resource.owner)) @@ -75,7 +75,7 @@ class Chef if casked? converge_by("uninstall cask #{new_resource.cask_name}") do - shell_out!("#{new_resource.homebrew_path} cask uninstall #{new_resource.cask_name}", + shell_out!("#{new_resource.homebrew_path} uninstall --cask #{new_resource.cask_name}", user: new_resource.owner, env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner }, cwd: ::Dir.home(new_resource.owner)) @@ -93,7 +93,7 @@ class Chef # @return [Boolean] def casked? unscoped_name = new_resource.cask_name.split("/").last - shell_out!("#{new_resource.homebrew_path} cask list 2>/dev/null", + shell_out!("#{new_resource.homebrew_path} list --cask 2>/dev/null", user: new_resource.owner, env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner }, cwd: ::Dir.home(new_resource.owner)).stdout.split.include?(unscoped_name) |