@@ -58,30 +58,27 @@ def create
5858 roles : role_hashes ( @resource [ :roles ] , @resource [ :database ] ) ,
5959 }
6060
61- # is this still needed / we only support verion 4 and higher
62- if mongo_4? || mongo_5? || mongo_6?
63- case @resource [ :auth_mechanism ]
64- when :scram_sha_256 # rubocop:disable Naming/VariableNumber
65- command [ :mechanisms ] = [ 'SCRAM-SHA-256' ]
66- command [ :pwd ] = @resource [ :password ]
67- command [ :digestPassword ] = true
68- when :scram_sha_1 # rubocop:disable Naming/VariableNumber
69- command [ :mechanisms ] = [ 'SCRAM-SHA-1' ]
70- command [ :pwd ] = password_hash
71- command [ :digestPassword ] = false
72- when :x509
73- command [ :mechanisms ] = [ 'MONGODB-X509' ]
74- else
75- command [ :pwd ] = password_hash
76- command [ :digestPassword ] = false
77-
78- end
61+ case @resource [ :auth_mechanism ]
62+ when :scram_sha_256 # rubocop:disable Naming/VariableNumber
63+ command [ :mechanisms ] = [ 'SCRAM-SHA-256' ]
64+ command [ :pwd ] = @resource [ :password ]
65+ command [ :digestPassword ] = true
66+ when :scram_sha_1 # rubocop:disable Naming/VariableNumber
67+ command [ :mechanisms ] = [ 'SCRAM-SHA-1' ]
68+ command [ :pwd ] = password_hash
69+ command [ :digestPassword ] = false
70+ when :x509
71+ command [ :mechanisms ] = [ 'MONGODB-X509' ]
72+ else
73+ command [ :pwd ] = password_hash
74+ command [ :digestPassword ] = false
7975 end
8076
81- Puppet . debug ( "XXXXXXXXXX about to create user with command: #{ command } " )
8277 if @resource [ :auth_mechanism ] == :x509
78+ Puppet . debug ( "XXXXXXXXXX about to create X509 user with command: #{ command } " )
8379 mongo_eval ( "db.getSiblingDB(\" $external\" ).runCommand(#{ command . to_json } }" , @resource [ :database ] )
8480 else
81+ Puppet . debug ( "XXXXXXXXXX about to create regular user with command: #{ command } " )
8582 mongo_eval ( "db.runCommand(#{ command . to_json } )" , @resource [ :database ] )
8683 end
8784 else
0 commit comments