Skip to content

Commit

Permalink
[x509 user] Use $external db for this type of users
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan De Wit committed Aug 17, 2023
1 parent 0ef6b99 commit f1062ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/puppet/provider/mongodb_user/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ def create
end

Puppet.debug("XXXXXXXXXX about to create user with command: #{command}")
mongo_eval("db.runCommand(#{command.to_json})", @resource[:database])
if @resource[:auth_mechanism] == :x509
mongo_eval("db.getSiblingDB(\"$external\").runCommand(#{command.to_json}}", @resource[:database])
else
mongo_eval("db.runCommand(#{command.to_json})", @resource[:database])
end
else
Puppet.warning 'User creation is available only from master host'

Expand Down

0 comments on commit f1062ad

Please sign in to comment.