Install proper mysql-client package

We should not install default mysql-client package, that is
defined in mysql::params::client_package_name. But instead we need
to calculate proper version of mysql-client in exactly the same
way as we do it in database.pp task when evaluate mysql::server
class. To do so we introduce new class galera::client and declare
it instead of ::mysql.

Change-Id: Ib118450656f99f68358e84a61b1684b8025e483c
Closes-bug: #1476599
This commit is contained in:
Aleksandr Didenko 2015-07-28 19:00:15 +03:00
parent 8e64ae8e01
commit a06f41a94d
17 changed files with 204 additions and 16 deletions

View File

@ -0,0 +1,77 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#
# == Define: galera::client
#
# Class for installation and configuration of mysql-client
#
# === Parameters
#
# [*custom_setup_class*]
# Custom mysql and galera setup class.
#
class galera::client (
$custom_setup_class = 'galera',
) {
if $custom_setup_class == 'percona' {
$use_percona = true
$use_percona_packages = false
} elsif ($custom_setup_class == 'percona_packages') {
$use_percona = true
$use_percona_packages = true
} else {
$use_percona = false
$use_percona_packages = false
}
if ($use_percona) {
case $::osfamily {
'RedHat': {
if ($use_percona_packages) {
$mysql_client_name = 'Percona-XtraDB-Cluster-client-56'
} else {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only supports Debian when not using the Percona packages")
}
}
'Debian': {
if ($use_percona_packages) {
$mysql_client_name = 'percona-xtradb-cluster-client-5.6'
} else {
$mysql_client_name = 'percona-xtradb-cluster-client-5.5'
}
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
}
}
} else {
case $::osfamily {
'RedHat': {
$mysql_client_name = 'MySQL-client-wsrep'
}
'Debian': {
$mysql_client_name = 'mysql-client-5.6'
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
}
}
}
package { 'mysql-client':
name => $mysql_client_name,
}
}

View File

@ -25,7 +25,9 @@ validate_string($database_vip)
if $db_create {
include mysql
class { 'galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { 'glance::db::mysql':
user => $db_user,
@ -40,7 +42,7 @@ if $db_create {
db_password => $db_root_password,
}
Class['mysql'] ->
Class['galera::client'] ->
Class['osnailyfacter::mysql_access'] ->
Class['glance::db::mysql']
}

View File

@ -24,7 +24,9 @@ validate_string($mysql_root_user)
if $db_create {
include mysql
class { 'galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { 'heat::db::mysql':
user => $db_user,
@ -39,7 +41,7 @@ if $db_create {
db_password => $db_root_password,
}
Class['mysql'] ->
Class['galera::client'] ->
Class['osnailyfacter::mysql_access'] ->
Class['heat::db::mysql']

View File

@ -24,7 +24,9 @@ $allowed_hosts = [ $node_name, 'localhost', '127.0.0.1', '%' ]
if $db_create {
include mysql
class { 'galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { 'keystone::db::mysql':
user => $db_user,
@ -39,7 +41,7 @@ if $db_create {
db_password => $db_root_password,
}
Class['mysql'] ->
Class['galera::client'] ->
Class['osnailyfacter::mysql_access'] ->
Class['keystone::db::mysql']

View File

@ -26,7 +26,9 @@ validate_string($mysql_root_user)
if $murano_enabled and $db_create {
include mysql
class { 'galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { 'murano::db::mysql':
user => $db_user,
@ -41,7 +43,7 @@ if $murano_enabled and $db_create {
db_password => $db_root_password,
}
Class['mysql'] ->
Class['galera::client'] ->
Class['osnailyfacter::mysql_access'] ->
Class['murano::db::mysql']

View File

@ -24,7 +24,9 @@ validate_string($mysql_root_user)
if $db_create {
include mysql
class { 'galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { 'cinder::db::mysql':
user => $db_user,
@ -39,7 +41,7 @@ if $db_create {
db_password => $db_root_password,
}
Class['mysql'] ->
Class['galera::client'] ->
Class['osnailyfacter::mysql_access'] ->
Class['cinder::db::mysql']

View File

@ -24,7 +24,9 @@ validate_string($mysql_root_user)
if $db_create {
include mysql
class { 'galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { 'nova::db::mysql':
user => $db_user,
@ -39,7 +41,7 @@ if $db_create {
db_password => $db_root_password,
}
Class['mysql'] ->
Class['galera::client'] ->
Class['osnailyfacter::mysql_access'] ->
Class['nova::db::mysql']

View File

@ -28,7 +28,9 @@ validate_string($mysql_root_user)
if $use_neutron and $db_create {
include mysql
class { 'galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { 'neutron::db::mysql':
user => $db_user,
@ -43,7 +45,7 @@ if $use_neutron and $db_create {
db_password => $db_root_password,
}
Class['mysql'] ->
Class['galera::client'] ->
Class['osnailyfacter::mysql_access'] ->
Class['neutron::db::mysql']

View File

@ -26,7 +26,9 @@ validate_string($mysql_root_user)
if $sahara_enabled and $db_create {
include mysql
class { 'galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { 'sahara::db::mysql':
user => $db_user,
@ -41,7 +43,7 @@ if $sahara_enabled and $db_create {
db_password => $db_root_password,
}
Class['mysql'] ->
Class['galera::client'] ->
Class['osnailyfacter::mysql_access'] ->
Class['sahara::db::mysql']

View File

@ -9,6 +9,16 @@ describe manifest do
glance_db_password = Noop.hiera_structure 'glance/db_password'
allowed_hosts = [Noop.hostname,'localhost','127.0.0.1','%']
it 'should install proper mysql-client' do
if facts[:osfamily] == 'RedHat'
pkg_name = 'MySQL-client-wsrep'
elsif facts[:osfamily] == 'Debian'
pkg_name = 'mysql-client-5.6'
end
should contain_package('mysql-client').with(
'name' => pkg_name,
)
end
it 'should declare glance::db::mysql class with user,password,dbname' do
should contain_class('glance::db::mysql').with(
'user' => glance_db_user,

View File

@ -9,6 +9,16 @@ describe manifest do
heat_db_password = Noop.hiera_structure 'heat/db_password'
allowed_hosts = [Noop.hostname,'localhost','127.0.0.1','%']
it 'should install proper mysql-client' do
if facts[:osfamily] == 'RedHat'
pkg_name = 'MySQL-client-wsrep'
elsif facts[:osfamily] == 'Debian'
pkg_name = 'mysql-client-5.6'
end
should contain_package('mysql-client').with(
'name' => pkg_name,
)
end
it 'should declare heat::db::mysql class with user,password,dbname' do
should contain_class('heat::db::mysql').with(
'user' => heat_db_user,

View File

@ -9,6 +9,16 @@ describe manifest do
keystone_db_password = Noop.hiera_structure 'keystone/db_password'
allowed_hosts = [Noop.hostname,'localhost','127.0.0.1','%']
it 'should install proper mysql-client' do
if facts[:osfamily] == 'RedHat'
pkg_name = 'MySQL-client-wsrep'
elsif facts[:osfamily] == 'Debian'
pkg_name = 'mysql-client-5.6'
end
should contain_package('mysql-client').with(
'name' => pkg_name,
)
end
it 'should declare keystone::db::mysql class with user,password,dbname' do
should contain_class('keystone::db::mysql').with(
'user' => keystone_db_user,

View File

@ -3,6 +3,22 @@ require 'shared-examples'
manifest = 'murano/db.pp'
describe manifest do
murano_hash = Noop.hiera('murano')
if murano_hash['enabled']
shared_examples 'catalog' do
it 'should install proper mysql-client' do
if facts[:osfamily] == 'RedHat'
pkg_name = 'MySQL-client-wsrep'
elsif facts[:osfamily] == 'Debian'
pkg_name = 'mysql-client-5.6'
end
should contain_package('mysql-client').with(
'name' => pkg_name,
)
end
end
end
test_ubuntu_and_centos manifest
end

View File

@ -9,6 +9,17 @@ describe manifest do
cinder_db_dbname = 'cinder'
allowed_hosts = [Noop.hostname,'localhost','127.0.0.1','%']
it 'should install proper mysql-client' do
if facts[:osfamily] == 'RedHat'
pkg_name = 'MySQL-client-wsrep'
elsif facts[:osfamily] == 'Debian'
pkg_name = 'mysql-client-5.6'
end
should contain_package('mysql-client').with(
'name' => pkg_name,
)
end
it 'should declare cinder::db::mysql class with user,password,dbname' do
should contain_class('cinder::db::mysql').with(
'user' => cinder_db_user,

View File

@ -9,6 +9,16 @@ describe manifest do
nova_db_dbname = 'nova'
allowed_hosts = [Noop.hostname,'localhost','127.0.0.1','%']
it 'should install proper mysql-client' do
if facts[:osfamily] == 'RedHat'
pkg_name = 'MySQL-client-wsrep'
elsif facts[:osfamily] == 'Debian'
pkg_name = 'mysql-client-5.6'
end
should contain_package('mysql-client').with(
'name' => pkg_name,
)
end
it 'should declare nova::db::mysql class with user,password,dbname' do
should contain_class('nova::db::mysql').with(
'user' => nova_db_user,

View File

@ -13,6 +13,17 @@ describe manifest do
neutron_db_password = Noop.hiera'neutron_db_password'
neutron_db_dbname = 'neutron'
it 'should install proper mysql-client' do
if facts[:osfamily] == 'RedHat'
pkg_name = 'MySQL-client-wsrep'
elsif facts[:osfamily] == 'Debian'
pkg_name = 'mysql-client-5.6'
end
should contain_package('mysql-client').with(
'name' => pkg_name,
)
end
it 'should declare neutron::db::mysql class with user,password,dbname' do
should contain_class('neutron::db::mysql').with(
'user' => neutron_db_user,

View File

@ -3,5 +3,22 @@ require 'shared-examples'
manifest = 'sahara/db.pp'
describe manifest do
sahara_hash = Noop.hiera('sahara')
if sahara_hash['enabled']
shared_examples 'catalog' do
it 'should install proper mysql-client' do
if facts[:osfamily] == 'RedHat'
pkg_name = 'MySQL-client-wsrep'
elsif facts[:osfamily] == 'Debian'
pkg_name = 'mysql-client-5.6'
end
should contain_package('mysql-client').with(
'name' => pkg_name,
)
end
end
end
test_ubuntu_and_centos manifest
end