Module: Chef::Mixin::HomebrewUser

Includes:
ShellOut
Included in:
Provider::Package::Homebrew
Defined in:
lib/chef/mixin/homebrew_user.rb

Instance Method Summary collapse

Methods included from ShellOut

#a_to_s, #clean_array, #shell_out, #shell_out!, #shell_out_compact, #shell_out_compact!, #shell_out_compact_timeout, #shell_out_compact_timeout!, #shell_out_with_systems_locale, #shell_out_with_systems_locale!

Methods included from PathSanity

#enforce_path_sanity, #sanitized_path

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