Skip to content

Commit 69c2e03

Browse files
committed
(MODULES-6875,MODULES-7487) - Fix mariadb mysql_user password idempotency
The change introduced in mariadb 10.2.16 (and 10.3.8) where: > the `SET PASSWORD` command stores user passwords in the `mysql_native_password` plugin `authentication_string` instead of in the `password` column was addressed in puppetlabs#1135 This behaviour was short-lived. In 10.2.19 and 10.3.11 the old behaviour was restored. > The fix in the commit dd6e74c62a2 made sure that the password field is always set, because that was the original issue that broke third-party tools. See https://jira.mariadb.org/browse/MDEV-16774 This commit is based on https://tickets.puppetlabs.com/browse/MODULES-6875?focusedCommentId=645260&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-645260
1 parent 0b9bb47 commit 69c2e03

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/puppet/provider/mysql.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ def newer_than(forks_versions)
8181
self.class.newer_than(forks_versions)
8282
end
8383

84+
def self.older_than(forks_versions)
85+
forks_versions.keys.include?(mysqld_type) && Puppet::Util::Package.versioncmp(mysqld_version, forks_versions[mysqld_type]) < 0
86+
end
87+
88+
def older_than(forks_versions)
89+
self.class.older_than(forks_versions)
90+
end
91+
8492
def defaults_file
8593
self.class.defaults_file
8694
end

lib/puppet/provider/mysql_user/mysql.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def self.instances
1414
## Default ...
1515
# rubocop:disable Metrics/LineLength
1616
query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'"
17-
elsif newer_than('mysql' => '5.7.6', 'percona' => '5.7.6', 'mariadb' => '10.2.16')
17+
elsif newer_than('mysql' => '5.7.6', 'percona' => '5.7.6') ||
18+
# https://jira.mariadb.org/browse/MDEV-16238 https://jira.mariadb.org/browse/MDEV-16774
19+
(newer_than('mariadb' => '10.2.16') && older_than('mariadb' => '10.2.19')) ||
20+
(newer_than('mariadb' => '10.3.8') && older_than('mariadb' => '10.3.11'))
1821
query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, AUTHENTICATION_STRING, PLUGIN FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'"
1922
else
2023
query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'"

0 commit comments

Comments
 (0)