Skip to content

Commit 6d3cc73

Browse files
author
Aleksandr Makhov
committed
Add mechanism (default SHA1) to password_hash command
According the ussie voxpupuli#649, the module ignore changes in passwrd hashes. Add the mechanism parameter to the password_hash command Changed unit test to mongodb_user due to new expected line generated for password_hash command.
1 parent d46d3ef commit 6d3cc73

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/puppet/provider/mongodb_user/mongodb.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def password_hash=(_value)
103103
pwd: @resource[:password_hash],
104104
digestPassword: false
105105
}
106-
command[:mechanisms] = ['SCRAM-SHA-1']
106+
command[:mechanisms] = @resource[:auth_mechanism] == :scram_sha_1 ? ['SCRAM-SHA-1'] : ['SCRAM-SHA-256']
107107

108108
mongo_eval("db.runCommand(#{command.to_json})", @resource[:database])
109109
else

spec/unit/puppet/provider/mongodb_user/mongodb_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
{
9494
"updateUser":"new_user",
9595
"pwd":"pass",
96-
"digestPassword":false
96+
"digestPassword":false,
97+
"mechanisms":["SCRAM-SHA-1"]
9798
}
9899
EOS
99100
allow(provider).to receive(:mongo_eval).

0 commit comments

Comments
 (0)