summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2021-02-05 20:39:05 -0800
committerTim Smith <tsmith84@gmail.com>2021-02-05 20:39:05 -0800
commit2fb7b07ab9cc8d9ef8b84c3b5b015d0aba6c9e01 (patch)
treebb2dca01d6988d9115a43323cf2fae76e334e961
parent77b90ec143b9b717be4a13a5bbe4d6a5bd62cacc (diff)
downloadchef-2fb7b07ab9cc8d9ef8b84c3b5b015d0aba6c9e01.tar.gz
Add the ability to force the install
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/homebrew_install.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/resource/homebrew_install.rb b/lib/chef/resource/homebrew_install.rb
index 98232dd72a..ccaf7376f6 100644
--- a/lib/chef/resource/homebrew_install.rb
+++ b/lib/chef/resource/homebrew_install.rb
@@ -61,9 +61,13 @@ class Chef
description: "The user to install Homebrew as. Note: Homebrew cannot be installed as root.",
required: true
+ property :force, [TrueClass, FalseClass],
+ description: "Force the installation of Homebrew even if the `/usr/local/bin/brew` command already exists on the system.",
+ default: false
+
action :install do
# Avoid all the work in the below resources if homebrew is already installed
- return if ::File.exist?("/usr/local/bin/brew")
+ return if !new_resource.force && ::File.exist?("/usr/local/bin/brew")
# check if 'user' is root and raise an exception if so
if Etc.getpwnam(new_resource.user).uid == 0