Skip to content

Commit f1062ad

Browse files
author
Johan De Wit
committed
[x509 user] Use $external db for this type of users
1 parent 0ef6b99 commit f1062ad

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/puppet/provider/mongodb_user/mongodb.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ def create
7979
end
8080

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

0 commit comments

Comments
 (0)