summaryrefslogtreecommitdiff
path: root/lib/chef/provider/user
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider/user')
-rw-r--r--lib/chef/provider/user/mac.rb16
-rw-r--r--lib/chef/provider/user/windows.rb13
2 files changed, 22 insertions, 7 deletions
diff --git a/lib/chef/provider/user/mac.rb b/lib/chef/provider/user/mac.rb
index a3980aa12f..aef831907a 100644
--- a/lib/chef/provider/user/mac.rb
+++ b/lib/chef/provider/user/mac.rb
@@ -221,7 +221,17 @@ class Chef
end
def compare_user
- %i{comment shell uid gid salt password admin secure_token hidden}.any? { |m| diverged?(m) }
+ @change_desc = []
+ %i{comment shell uid gid salt password admin secure_token hidden}.each do |attr|
+ if diverged?(m)
+ desc = "Update #{attr}"
+ unless %i{password gid secure_token hidden}.include?(attr)
+ desc << " from #{current_resource.send(attr)} to #{new_resource.send(attr)}"
+ end
+ @change_desc << desc
+ end
+ end
+ !@change_desc.empty?
end
def manage_user
@@ -290,9 +300,7 @@ class Chef
end
if diverged?(:hidden)
- converge_by("alter hidden") do
- set_hidden
- end
+ converge_by("alter hidden") { set_hidden }
end
reload_user_plist
diff --git a/lib/chef/provider/user/windows.rb b/lib/chef/provider/user/windows.rb
index 6d50e2c8ee..32b2c35264 100644
--- a/lib/chef/provider/user/windows.rb
+++ b/lib/chef/provider/user/windows.rb
@@ -61,13 +61,20 @@ class Chef
# <true>:: If a change is required
# <false>:: If the users are identical
def compare_user
+ @change_desc = []
unless @net_user.validate_credentials(new_resource.password)
- logger.trace("#{new_resource} password has changed")
- return true
+ @change_desc << "update password"
end
+
%i{uid comment home shell full_name}.any? do |user_attrib|
- !new_resource.send(user_attrib).nil? && new_resource.send(user_attrib) != current_resource.send(user_attrib)
+ new_val = new_resource.send(user_attrib)
+ cur_val = current_resource.send(user_attrib)
+ if !new_val.nil? && new_val != cur_val
+ @change_desc << "change #{user_attrib} from #{cur_val} to #{new_val}"
+ end
end
+
+ !@change_desc.empty?
end
def create_user