Module: Chef::Mixin::HomebrewUser
- Includes:
- ShellOut
- Included in:
- Provider::Package::Homebrew
- Defined in:
- lib/chef/mixin/homebrew_user.rb
Constant Summary
Constants included from ShellOut
Instance Method Summary collapse
-
#find_homebrew_uid(provided_user = nil) ⇒ Object
This tries to find the user to execute brew as.
Methods included from ShellOut
#run_command_compatible_options, #shell_out, #shell_out!, #shell_out_with_systems_locale, #shell_out_with_systems_locale!
Instance Method Details
#find_homebrew_uid(provided_user = nil) ⇒ Object
This tries to find the user to execute brew as. If a user is provided, that overrides the brew executable user. It is an error condition if the brew executable owner is root or we cannot find the brew executable.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/chef/mixin/homebrew_user.rb', line 37 def find_homebrew_uid(provided_user = nil) # They could provide us a user name or a UID if provided_user return provided_user if provided_user.is_a? Integer return Etc.getpwnam(provided_user).uid end @homebrew_owner ||= calculate_owner @homebrew_owner end |