database/sql: Clean-up

I did not change the behavior of Sofer fix, just did some clean-up:
- git rebase
- delete cloud::debian::galera_patch class and use cloud::database::sql
  in the case.
- rename the initd mysql template to be able having one template for
  RHEL later if needed.
- fix unit tests

Note:
- The bug is not fixed on RHEL yet
- Unit tests are incomplete and don't cover when galera master role.

Fix #11

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi 2014-01-28 10:52:50 +01:00
parent d874be9ced
commit 257e3f9a2d
4 changed files with 12 additions and 48 deletions

View File

@ -94,7 +94,16 @@ class cloud::database::sql (
}
if($::osfamily == 'Debian'){
class { 'cloud::debian::galera_patch' : }
file { '/etc/init.d/mysql-bootstrap':
content => template('cloud/database/etc_initd_mysql_debian'),
owner => 'root',
mode => '0755',
group => 'root',
notify => Service['mysqld'],
before => Package['mysql-server'],
}
}
$gcomm_base = inline_template('<%= @galera_internal_ips.join(",") + "?pc.wait_prim=no" -%>')

View File

@ -1,45 +0,0 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# 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.
#
# == Class: cloud::debian::galera_patch
#
# Install a dedicated mysqld init script
#
# This is due to this bug: https://bugs.launchpad.net/codership-mysql/+bug/1087368
#
# The backport to API 23 requires a command line option --wsrep-new-cluster:
#
# http://bazaar.launchpad.net/~codership/codership-mysql/wsrep-5.5/revision/3844?start_revid=3844
#
# and the mysql init script cannot have arguments passed to the daemon
# using /etc/default/mysql standart mechanism
#
# To check that the mysqld support the options you can :
# strings `which mysqld` | grep wsrep-new-cluster
#
# TODO: to be remove as soon as the API 25 is packaged, ie galera 3 ...
class cloud::debian::galera_patch (
) {
# replace the file
file { '/etc/init.d/mysql-bootstrap':
content => template('cloud/database/etc_initd_mysql'),
owner => 'root',
mode => '0755',
group => 'root',
notify => Service['mysqld'],
before => Package['mysql-server'],
}
}

View File

@ -31,7 +31,7 @@ describe 'cloud::database::sql' do
:service_provider => 'sysv',
:api_eth => '10.0.0.1',
:galera_master_name => 'os-ci-test1',
:galera_nextserver => ['10.0.0.1','10.0.0.2','10.0.0.3'],
:galera_internal_ips => ['10.0.0.1','10.0.0.2','10.0.0.3'],
:keystone_db_host => '10.0.0.1',
:keystone_db_user => 'keystone',
:keystone_db_password => 'secrete',
@ -73,7 +73,7 @@ describe 'cloud::database::sql' do
)
should contain_class('mysql::server').with(
:config_hash => { 'bind_address' => '10.0.0.1', 'root_password' => params[:mysql_root_password] },
:config_hash => { 'bind_address' => '10.0.0.1', 'root_password' => params[:mysql_root_password], 'service_name' => 'mysql' },
:notify => 'Service[xinetd]'
)
end # configure mysql galera server