Mercurial > repos > other > Puppet
diff modules/mysql/lib/puppet/provider/mysql.rb @ 389:668df4711671
Update MySQL modules
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 03 Jan 2022 17:16:21 +0000 |
parents | 48d3a1948e4d |
children | adf6fe9bbc17 |
line wrap: on
line diff
--- a/modules/mysql/lib/puppet/provider/mysql.rb Mon Jan 03 17:15:14 2022 +0000 +++ b/modules/mysql/lib/puppet/provider/mysql.rb Mon Jan 03 17:16:21 2022 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Puppet provider for mysql class Puppet::Provider::Mysql < Puppet::Provider # Without initvars commands won't work. @@ -13,6 +15,8 @@ '/opt/rh/rh-mysql56/root/usr/lib64', '/opt/rh/rh-mysql57/root/usr/lib', '/opt/rh/rh-mysql57/root/usr/lib64', + '/opt/rh/rh-mysql80/root/usr/lib', + '/opt/rh/rh-mysql80/root/usr/lib64', '/opt/rh/rh-mariadb100/root/usr/lib', '/opt/rh/rh-mariadb100/root/usr/lib64', '/opt/rh/rh-mariadb101/root/usr/lib', @@ -67,10 +71,10 @@ end def self.mysqld_version - # note: be prepared for '5.7.6-rc-log' etc results + # NOTE: be prepared for '5.7.6-rc-log' etc results # versioncmp detects 5.7.6-log to be newer then 5.7.6 # this is why we need the trimming. - mysqld_version_string.scan(%r{\d+\.\d+\.\d+}).first unless mysqld_version_string.nil? + mysqld_version_string&.scan(%r{\d+\.\d+\.\d+})&.first end def mysqld_version @@ -78,7 +82,7 @@ end def self.newer_than(forks_versions) - forks_versions.keys.include?(mysqld_type) && Puppet::Util::Package.versioncmp(mysqld_version, forks_versions[mysqld_type]) >= 0 + forks_versions.key?(mysqld_type) && Puppet::Util::Package.versioncmp(mysqld_version, forks_versions[mysqld_type]) >= 0 end def newer_than(forks_versions) @@ -86,7 +90,7 @@ end def self.older_than(forks_versions) - forks_versions.keys.include?(mysqld_type) && Puppet::Util::Package.versioncmp(mysqld_version, forks_versions[mysqld_type]) < 0 + forks_versions.key?(mysqld_type) && Puppet::Util::Package.versioncmp(mysqld_version, forks_versions[mysqld_type]) < 0 end def older_than(forks_versions) @@ -101,16 +105,16 @@ if type.eql? 'system' if File.file?("#{Facter.value(:root_home)}/.mylogin.cnf") ENV['MYSQL_TEST_LOGIN_FILE'] = "#{Facter.value(:root_home)}/.mylogin.cnf" - mysql_raw([system_database, '-e', text_of_sql].flatten.compact) + mysql_raw([system_database, '-e', text_of_sql].flatten.compact).scrub else - mysql_raw([defaults_file, system_database, '-e', text_of_sql].flatten.compact) + mysql_raw([defaults_file, system_database, '-e', text_of_sql].flatten.compact).scrub end elsif type.eql? 'regular' if File.file?("#{Facter.value(:root_home)}/.mylogin.cnf") ENV['MYSQL_TEST_LOGIN_FILE'] = "#{Facter.value(:root_home)}/.mylogin.cnf" - mysql_raw(['-NBe', text_of_sql].flatten.compact) + mysql_raw(['-NBe', text_of_sql].flatten.compact).scrub else - mysql_raw([defaults_file, '-NBe', text_of_sql].flatten.compact) + mysql_raw([defaults_file, '-NBe', text_of_sql].flatten.compact).scrub end else raise Puppet::Error, _("#mysql_caller: Unrecognised type '%{type}'" % { type: type }) @@ -141,7 +145,7 @@ table_string = '' # We can't escape *.* so special case this. - table_string << if table == '*.*' + table_string += if table == '*.*' '*.*' # Special case also for FUNCTIONs and PROCEDUREs elsif table.start_with?('FUNCTION ', 'PROCEDURE ') @@ -156,7 +160,7 @@ return 'ALL PRIVILEGES' if privileges.include?('ALL') priv_string = '' privileges.each do |priv| - priv_string << "#{priv}, " + priv_string += "#{priv}, " end # Remove trailing , from the last element. priv_string.sub(%r{, $}, '') @@ -166,7 +170,7 @@ def self.cmd_options(options) option_string = '' options.each do |opt| - option_string << ' WITH GRANT OPTION' if opt == 'GRANT' + option_string += ' WITH GRANT OPTION' if opt == 'GRANT' end option_string end