summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorTyler Ball <tyleraball@gmail.com>2014-10-13 13:58:09 -0500
committerTyler Ball <tyleraball@gmail.com>2014-10-13 13:58:09 -0500
commit87ebd29a5632d4a2598b12b99ecc9d2ee2b4586f (patch)
treed8c29af59da6cc228a6dfbeae133f9fe92fed788 /lib/chef
parent57b6b93cfe8f32e30c03503d1facf9fac011842c (diff)
parent4cb27331d81b394b816278e2bed6b3395b54b9c9 (diff)
downloadchef-87ebd29a5632d4a2598b12b99ecc9d2ee2b4586f.tar.gz
Merge pull request #2215 from opscode/tball/homebrew_fix
Fixing bug where tried to use the homebrew provider on OSX and didn't correctly check for lack of homebrew-specific attribute on the resource
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/mixin/homebrew_user.rb2
-rw-r--r--lib/chef/provider/package/homebrew.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/mixin/homebrew_user.rb b/lib/chef/mixin/homebrew_user.rb
index 854a954a90..ab6fb19563 100644
--- a/lib/chef/mixin/homebrew_user.rb
+++ b/lib/chef/mixin/homebrew_user.rb
@@ -36,7 +36,7 @@ class Chef
# the brew executable.
def find_homebrew_uid(provided_user = nil)
# They could provide us a user name or a UID
- unless provided_user.nil?
+ if provided_user
return provided_user if provided_user.is_a? Integer
return Etc.getpwnam(provided_user).uid
end
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb
index 202e4d2533..a9aeea1415 100644
--- a/lib/chef/provider/package/homebrew.rb
+++ b/lib/chef/provider/package/homebrew.rb
@@ -109,7 +109,7 @@ class Chef
private
def get_response_from_command(command)
- homebrew_uid = find_homebrew_uid(new_resource.homebrew_user)
+ homebrew_uid = find_homebrew_uid(new_resource.respond_to?(:homebrew_user) && new_resource.homebrew_user)
homebrew_user = Etc.getpwuid(homebrew_uid)
Chef::Log.debug "Executing '#{command}' as user '#{homebrew_user.name}'"