Skip to content

Commit

Permalink
(PUP-2647) Report when password is changed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joshcooper committed Oct 1, 2014
1 parent eca580f commit 7193960
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/user/windows_adsi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/provider/user/windows_adsi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7193960

Please sign in to comment.