diff options
author | Eric Saxby <sax@livinginthepast.org> | 2013-05-19 13:33:32 -0700 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-09-24 14:10:20 -0700 |
commit | e46feedadd6842e7b904b45d7c487720e096faf5 (patch) | |
tree | 689f3fb6ec279e013e29464cc94915cd4c60e601 /lib/chef | |
parent | 81944974acd3b5e4d36f5a7cde05aa619eaffa45 (diff) | |
download | chef-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/chef')
-rw-r--r-- | lib/chef/provider/user.rb | 12 |
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 |