Add logic to use use available mysql module
The Infra team upgraded the puppetlabs-mysql module from 0.6.1 to 3.6.2 which had backwards-incompatible API changes to the mysql::server class. Now the acceptance tests use the new module, and therefore fail[1]. This patch uses the load_module_metadata function to determine what version of the mysql module is installed and use the right parameters. When the newer version is found, we also exchange the mysql-client package resource for the mysql::client class; this way we can include it without conflicting with the mysql-client package installed by the newer module, but still have the client available when the gerrit::mysql class isn't used at all. Since Infra is only using the new module, that is the only code path that will be tested by beaker, so using the old mysql module is effectively unsupported. This will have no effect on Infra's infrastructure since we do not use the gerrit::mysql class. This will affect downstream users since they must have the latest version of puppetlabs-stdlib installed to use the load_module_metadata function. However, using that function gives downstream users the flexibility to upgrade the mysql module when they can, which is a bigger undertaking than upgrading the stdlib module. [1] http://logs.openstack.org/53/262053/5/check/gate-puppet-gerrit-puppet-beaker-rspec-dsvm-trusty-nv/7f9eb0d/console.html Change-Id: Ifdc55f22282f75ab4db0aa9f51db9143f0d74d24 Depends-On: I969b8c077b2b169f6fe65cb9c1256d043dd66e56
This commit is contained in:
parent
839c993ba1
commit
1beaefcf9e
|
@ -728,8 +728,15 @@ class gerrit(
|
|||
],
|
||||
}
|
||||
|
||||
package { 'mysql-client':
|
||||
ensure => present,
|
||||
$mysql_data = load_module_metadata('mysql', true)
|
||||
if $mysql_data == {} {
|
||||
package { 'mysql-client':
|
||||
ensure => present,
|
||||
before => File['/etc/mysql/conf.d/client.conf'],
|
||||
}
|
||||
} else {
|
||||
include ::mysql::client
|
||||
Class['::mysql::client'] -> File['/etc/mysql/conf.d/client.conf']
|
||||
}
|
||||
# Add config to make clients assume UTF-8 encoding
|
||||
file { '/etc/mysql/conf.d/client.conf':
|
||||
|
@ -739,7 +746,6 @@ class gerrit(
|
|||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
require => Package['mysql-client'],
|
||||
}
|
||||
|
||||
# Gerrit 2.10 requires libs not available in ubuntu repositories
|
||||
|
|
|
@ -7,11 +7,26 @@ class gerrit::mysql(
|
|||
$database_password = '',
|
||||
) {
|
||||
|
||||
class { '::mysql::server':
|
||||
config_hash => {
|
||||
'root_password' => $mysql_root_password,
|
||||
'default_engine' => 'InnoDB',
|
||||
'bind_address' => '127.0.0.1',
|
||||
$mysql_data = load_module_metadata('mysql', true)
|
||||
if $mysql_data == {} {
|
||||
warning("An old version of the puppetlabs-mysql module was found on your \
|
||||
system. The gerrit module only officially supports the latest 3.x version of \
|
||||
the mysql module.")
|
||||
class { '::mysql::server':
|
||||
config_hash => {
|
||||
'root_password' => $mysql_root_password,
|
||||
'default_engine' => 'InnoDB',
|
||||
'bind_address' => '127.0.0.1',
|
||||
}
|
||||
}
|
||||
} else { # If it has metadata.json, assume it's new enough to use this interface
|
||||
class { '::mysql::server':
|
||||
root_password => $mysql_root_password,
|
||||
override_options => {
|
||||
'mysqld' => {
|
||||
'default-storage-engine' => 'InnoDB',
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
include ::mysql::server::account_security
|
||||
|
|
Loading…
Reference in New Issue