File tree 1 file changed +6
-3
lines changed
lib/puppet/provider/mysql_user
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -169,9 +169,12 @@ def password_hash=(string)
169
169
self . class . mysql_caller ( sql , 'system' )
170
170
elsif !mysqld_version . nil? && newer_than ( 'mysql' => '5.7.6' , 'percona' => '5.7.6' , 'mariadb' => '10.2.0' )
171
171
raise ArgumentError , _ ( 'Only mysql_native_password (*ABCD...XXX) or caching_sha2_password (0x1234ABC...XXX) hashes are supported.' ) unless %r{^\* |^$} . match? ( string ) || %r{0x[A-F0-9]+$} . match? ( string )
172
-
173
172
sql = "ALTER USER #{ merged_name } IDENTIFIED WITH"
174
- plugin == 'caching_sha2_password' ? sql += " '#{ plugin } ' AS X'#{ @resource [ :password_hash ] [ 2 ..-1 ] } '" : sql += " 'mysql_native_password' AS '#{ @resource [ :password_hash ] } '"
173
+ if plugin == 'caching_sha2_password'
174
+ sql += " 'caching_sha2_password' AS X'#{ string [ 2 ..-1 ] } '"
175
+ else
176
+ sql += " 'mysql_native_password' AS '#{ string } '"
177
+ end
175
178
self . class . mysql_caller ( sql , 'system' )
176
179
else
177
180
# default ... if mysqld_version does not work
@@ -238,7 +241,7 @@ def plugin=(string)
238
241
if string == 'mysql_native_password'
239
242
sql += " AS '#{ @resource [ :password_hash ] } '"
240
243
elsif string == 'caching_sha2_password'
241
- sql += " AS X'#{ password_hash [ 2 ..-1 ] } '"
244
+ sql += " AS X'#{ @resource [ : password_hash] [ 2 ..-1 ] } '"
242
245
end
243
246
else
244
247
# See https://bugs.mysql.com/bug.php?id=67449
You can’t perform that action at this time.
0 commit comments