Skip to content

Commit d84e65c

Browse files
committed
Fix frozen string errors
1 parent 311cef4 commit d84e65c

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

lib/puppet/provider/mysql.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def self.cmd_table(table)
145145
table_string = ''
146146

147147
# We can't escape *.* so special case this.
148-
table_string << if table == '*.*'
148+
table_string += if table == '*.*'
149149
'*.*'
150150
# Special case also for FUNCTIONs and PROCEDUREs
151151
elsif table.start_with?('FUNCTION ', 'PROCEDURE ')
@@ -160,7 +160,7 @@ def self.cmd_privs(privileges)
160160
return 'ALL PRIVILEGES' if privileges.include?('ALL')
161161
priv_string = ''
162162
privileges.each do |priv|
163-
priv_string << "#{priv}, "
163+
priv_string += "#{priv}, "
164164
end
165165
# Remove trailing , from the last element.
166166
priv_string.sub(%r{, $}, '')
@@ -170,7 +170,7 @@ def self.cmd_privs(privileges)
170170
def self.cmd_options(options)
171171
option_string = ''
172172
options.each do |opt|
173-
option_string << ' WITH GRANT OPTION' if opt == 'GRANT'
173+
option_string += ' WITH GRANT OPTION' if opt == 'GRANT'
174174
end
175175
option_string
176176
end

lib/puppet/provider/mysql_grant/mysql.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ def grant(user, table, privileges, options)
8181
priv_string = self.class.cmd_privs(privileges)
8282
table_string = privileges.include?('PROXY') ? self.class.cmd_user(table) : self.class.cmd_table(table)
8383
query = "GRANT #{priv_string}"
84-
query << " ON #{table_string}"
85-
query << " TO #{user_string}"
86-
query << self.class.cmd_options(options) unless options.nil?
84+
query += " ON #{table_string}"
85+
query += " TO #{user_string}"
86+
query += self.class.cmd_options(options) unless options.nil?
8787
self.class.mysql_caller(query, 'system')
8888
end
8989

lib/puppet/provider/mysql_login_path/inifile.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,11 @@ def parse_value(string)
461461
if leading_quote?
462462
# check for a closing quote at the end of the string
463463
if string =~ @close_quote
464-
value << Regexp.last_match(1)
464+
self.value += Regexp.last_match(1)
465465

466466
# otherwise just append the string to the value
467467
else
468-
value << string
468+
self.value += string
469469
continuation = true
470470
end
471471

@@ -480,19 +480,27 @@ def parse_value(string)
480480
continuation = true
481481

482482
when @trailing_slash
483-
value ? value << Regexp.last_match(1) : self.value = Regexp.last_match(1)
483+
if self.value
484+
self.value += Regexp.last_match(1)
485+
else
486+
self.value = Regexp.last_match(1)
487+
end
484488
continuation = true
485489

486490
when @normal_value
487-
value ? value << Regexp.last_match(1) : self.value = Regexp.last_match(1)
491+
if self.value
492+
self.value += Regexp.last_match(1)
493+
else
494+
self.value = Regexp.last_match(1)
495+
end
488496

489497
else
490498
error
491499
end
492500
end
493501

494502
if continuation
495-
value << $INPUT_RECORD_SEPARATOR if leading_quote?
503+
self.value += $INPUT_RECORD_SEPARATOR if leading_quote?
496504
else
497505
process_property
498506
end

lib/puppet/provider/mysql_user/mysql.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def password_hash=(string)
159159
else
160160
concat_name = @resource[:name]
161161
sql = "UPDATE mysql.user SET password = '', plugin = 'ed25519'"
162-
sql << ", authentication_string = '#{string}'"
163-
sql << " where CONCAT(user, '@', host) = '#{concat_name}'; FLUSH PRIVILEGES"
162+
sql += ", authentication_string = '#{string}'"
163+
sql += " where CONCAT(user, '@', host) = '#{concat_name}'; FLUSH PRIVILEGES"
164164
end
165165
self.class.mysql_caller(sql, 'system')
166166
elsif newer_than('mysql' => '5.7.6', 'percona' => '5.7.6', 'mariadb' => '10.2.0')
@@ -210,17 +210,17 @@ def plugin=(string)
210210
else
211211
concat_name = @resource[:name]
212212
sql = "UPDATE mysql.user SET password = '', plugin = '#{string}'"
213-
sql << ", authentication_string = '#{@resource[:password_hash]}'"
214-
sql << " where CONCAT(user, '@', host) = '#{concat_name}'; FLUSH PRIVILEGES"
213+
sql += ", authentication_string = '#{@resource[:password_hash]}'"
214+
sql += " where CONCAT(user, '@', host) = '#{concat_name}'; FLUSH PRIVILEGES"
215215
end
216216
elsif newer_than('mysql' => '5.7.6', 'percona' => '5.7.6', 'mariadb' => '10.2.0')
217217
sql = "ALTER USER #{merged_name} IDENTIFIED WITH '#{string}'"
218-
sql << " AS '#{@resource[:password_hash]}'" if string == 'mysql_native_password'
218+
sql += " AS '#{@resource[:password_hash]}'" if string == 'mysql_native_password'
219219
else
220220
# See https://bugs.mysql.com/bug.php?id=67449
221221
sql = "UPDATE mysql.user SET plugin = '#{string}'"
222-
sql << ((string == 'mysql_native_password') ? ", password = '#{@resource[:password_hash]}'" : ", password = ''")
223-
sql << " WHERE CONCAT(user, '@', host) = '#{@resource[:name]}'"
222+
sql += ((string == 'mysql_native_password') ? ", password = '#{@resource[:password_hash]}'" : ", password = ''")
223+
sql += " WHERE CONCAT(user, '@', host) = '#{@resource[:name]}'"
224224
end
225225

226226
self.class.mysql_caller(sql, 'system')

0 commit comments

Comments
 (0)