summaryrefslogtreecommitdiff
path: root/lib/chef/mixin
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-09-30 11:16:31 -0700
committertyler-ball <tyleraball@gmail.com>2014-10-07 15:34:34 -0700
commit25104da3b9be7545ca8911cb0f11a42f524989a3 (patch)
treebd279b75a00e1b0e27cbae7a2995b372d0242e31 /lib/chef/mixin
parentd4c52ac9722d67829e3d1393ba0b9cc59eb003ed (diff)
downloadchef-25104da3b9be7545ca8911cb0f11a42f524989a3.tar.gz
Moving documentation to a more logical place. Also no longer dis-allowing users from running brew as root.
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r--lib/chef/mixin/homebrew_user.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/chef/mixin/homebrew_user.rb b/lib/chef/mixin/homebrew_user.rb
index 6e86e3824f..854a954a90 100644
--- a/lib/chef/mixin/homebrew_user.rb
+++ b/lib/chef/mixin/homebrew_user.rb
@@ -42,11 +42,6 @@ class Chef
end
@homebrew_owner ||= calculate_owner
- if @homebrew_owner == 0
- raise Chef::Exceptions::HomebrewOwnerIsRoot,
- 'The homebrew owner is currently "root". This is not suggested by the' +
- 'homebrew maintainers.'
- end
@homebrew_owner
end
@@ -56,13 +51,16 @@ class Chef
default_brew_path = '/usr/local/bin/brew'
if ::File.exist?(default_brew_path)
# By default, this follows symlinks which is what we want
- ::File.stat(default_brew_path).uid
+ owner = ::File.stat(default_brew_path).uid
elsif (brew_path = shell_out("which brew").stdout.strip) && !brew_path.empty?
- ::File.stat(brew_path).uid
+ owner = ::File.stat(brew_path).uid
else
raise Chef::Exceptions::CannotDetermineHomebrewOwner,
'Could not find the "brew" executable in /usr/local/bin or anywhere on the path.'
end
+
+ Chef::Log.debug "Found Homebrew owner #{Etc.getpwuid(owner).name}; executing `brew` commands as them"
+ owner
end
end