From 7193960b5a42ac763d4ddf3abd5ff759fbd65ab8 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 30 Sep 2014 22:09:26 -0700 Subject: [PATCH] (PUP-2647) Report when password is changed Previously, if Puppet changed the user's password, it would always report that the password was created, instead of changed. This was because the provider's `password` getter method returned :absent when the current password didn't match the desired value. This commit changes the windows user provider to return nil if the passwords don't match. This will cause puppet to sync the passwords and correctly report that the password was changed. --- lib/puppet/provider/user/windows_adsi.rb | 2 +- spec/unit/provider/user/windows_adsi_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/user/windows_adsi.rb b/lib/puppet/provider/user/windows_adsi.rb index fbca8744bf0..22f76d5c6c4 100644 --- a/lib/puppet/provider/user/windows_adsi.rb +++ b/lib/puppet/provider/user/windows_adsi.rb @@ -71,7 +71,7 @@ def home=(value) end def password - user.password_is?( @resource[:password] ) ? @resource[:password] : :absent + user.password_is?( @resource[:password] ) ? @resource[:password] : nil end def password=(value) diff --git a/spec/unit/provider/user/windows_adsi_spec.rb b/spec/unit/provider/user/windows_adsi_spec.rb index 84aa8a74cea..47d097b0cab 100755 --- a/spec/unit/provider/user/windows_adsi_spec.rb +++ b/spec/unit/provider/user/windows_adsi_spec.rb @@ -111,7 +111,7 @@ resource[:password] = 'plaintext' provider.user.expects(:password_is?).with('plaintext').returns false - provider.password.should == :absent + provider.password.should be_nil end it 'should not create a user if a group by the same name exists' do