summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEric Saxby <sax@livinginthepast.org>2013-05-19 13:33:32 -0700
committerBryan McLellan <btm@opscode.com>2013-09-24 14:10:20 -0700
commite46feedadd6842e7b904b45d7c487720e096faf5 (patch)
tree689f3fb6ec279e013e29464cc94915cd4c60e601 /lib
parent81944974acd3b5e4d36f5a7cde05aa619eaffa45 (diff)
downloadchef-e46feedadd6842e7b904b45d7c487720e096faf5.tar.gz
User provider does not update user when uid/gid are strings
Fixes [CHEF-4200]. If the user provider was sent UID as a string, comparing to the already-created user would always think that the user had changed.
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/user.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb
index e815ba9c9e..78aedd1b30 100644
--- a/lib/chef/provider/user.rb
+++ b/lib/chef/provider/user.rb
@@ -79,9 +79,7 @@ class Chef
end
end
- if @new_resource.gid
- convert_group_name
- end
+ convert_group_name if @new_resource.gid
end
@current_resource
@@ -112,9 +110,15 @@ class Chef
# <true>:: If a change is required
# <false>:: If the users are identical
def compare_user
- [ :uid, :gid, :comment, :home, :shell, :password ].any? do |user_attrib|
+ changed = [ :comment, :home, :shell, :password ].keep_if do |user_attrib|
!@new_resource.send(user_attrib).nil? && @new_resource.send(user_attrib) != @current_resource.send(user_attrib)
end
+
+ changed += [ :uid, :gid ].keep_if do |user_attrib|
+ !@new_resource.send(user_attrib).nil? && @new_resource.send(user_attrib).to_i != @current_resource.send(user_attrib).to_i
+ end
+
+ changed.any?
end
def action_create